@@ -356,6 +356,67 @@ func TestGetOverriddenValues(t *testing.T) {
356356 }
357357}
358358
359+ func TestApplyAnnotationOverridesMissingProxyTracing (t * testing.T ) {
360+ values := & l5dcharts.Values {
361+ Proxy : & l5dcharts.Proxy {
362+ Image : & l5dcharts.Image {},
363+ Ports : & l5dcharts.Ports {},
364+ Metrics : & l5dcharts.ProxyMetrics {},
365+ },
366+ ProxyInit : & l5dcharts.ProxyInit {
367+ Image : & l5dcharts.Image {},
368+ },
369+ }
370+
371+ annotations := map [string ]string {
372+ k8s .TracingSemanticConventionPrefix + "http.method" : "GET" ,
373+ }
374+ labels := map [string ]string {
375+ k8s .TracingInstanceLabel : "example" ,
376+ }
377+
378+ ApplyAnnotationOverrides (values , annotations , labels , nil )
379+
380+ if values .Proxy .Tracing != nil {
381+ t .Fatalf ("expected tracing to remain nil, got %#v" , values .Proxy .Tracing )
382+ }
383+ }
384+
385+ func TestApplyAnnotationOverridesInitializesTracingLabels (t * testing.T ) {
386+ values := & l5dcharts.Values {
387+ Proxy : & l5dcharts.Proxy {
388+ Tracing : & l5dcharts.Tracing {},
389+ Image : & l5dcharts.Image {},
390+ Ports : & l5dcharts.Ports {},
391+ Metrics : & l5dcharts.ProxyMetrics {},
392+ },
393+ ProxyInit : & l5dcharts.ProxyInit {
394+ Image : & l5dcharts.Image {},
395+ },
396+ }
397+
398+ annotations := map [string ]string {
399+ k8s .TracingSemanticConventionPrefix + "http.target" : "/health" ,
400+ }
401+ labels := map [string ]string {
402+ k8s .TracingNameLabel : "workload" ,
403+ }
404+
405+ ApplyAnnotationOverrides (values , annotations , labels , nil )
406+
407+ if values .Proxy .Tracing == nil {
408+ t .Fatal ("expected tracing to be initialized" )
409+ }
410+
411+ if got := values .Proxy .Tracing .Labels [k8s .TracingServiceName ]; got != "workload" {
412+ t .Fatalf ("expected tracing service name to be set, got %q" , got )
413+ }
414+
415+ if got := values .Proxy .Tracing .Labels ["http.target" ]; got != "/health" {
416+ t .Fatalf ("expected tracing semantic convention label to be set, got %q" , got )
417+ }
418+ }
419+
359420func TestWholeCPUCores (t * testing.T ) {
360421 for _ , c := range []struct {
361422 v string
0 commit comments