Adding Zipkin collector to the E2E opentracing test as it is required to load at least one tracer to enable opentracing

Work on PR comments
Add tests for template builder

Signed-off-by: Bernard Van De Walle <bernard.vandewalle@getcruise.com>
This commit is contained in:
Bernard Van De Walle 2020-07-23 12:55:18 -07:00
parent 2baca9e32a
commit f3537204d2
4 changed files with 38 additions and 20 deletions

View file

@ -970,6 +970,13 @@ func buildOpentracing(c interface{}, s interface{}) string {
buf.WriteString("\r\n")
if cfg.OpentracingOperationName != "" {
buf.WriteString(fmt.Sprintf("opentracing_operation_name \"%s\";\n", cfg.OpentracingOperationName))
}
if cfg.OpentracingLocationOperationName != "" {
buf.WriteString(fmt.Sprintf("opentracing_location_operation_name \"%s\";\n", cfg.OpentracingLocationOperationName))
}
return buf.String()
}

View file

@ -1193,6 +1193,21 @@ func TestBuildOpenTracing(t *testing.T) {
t.Errorf("Expected '%v' but returned '%v'", expected, actual)
}
cfgOpenTracing := config.Configuration{
EnableOpentracing: true,
DatadogCollectorHost: "datadog-host.com",
OpentracingOperationName: "my-operation-name",
OpentracingLocationOperationName: "my-location-operation-name",
}
expected = "opentracing_load_tracer /usr/local/lib64/libdd_opentracing.so /etc/nginx/opentracing.json;\r\n"
expected += "opentracing_operation_name \"my-operation-name\";\n"
expected += "opentracing_location_operation_name \"my-location-operation-name\";\n"
actual = buildOpentracing(cfgOpenTracing, []*ingress.Server{})
if expected != actual {
t.Errorf("Expected '%v' but returned '%v'", expected, actual)
}
}
func TestEnforceRegexModifier(t *testing.T) {