Documentation ¶
Overview ¶
Package namingschematest provides utilities to test naming schemas across different integrations.
Index ¶
- Constants
- func NewKafkaOpNameTest(genSpans GenSpansFn) func(t *testing.T)
- func NewOpNameTest(genSpans GenSpansFn, assertV0 AssertSpansFn, assertV1 AssertSpansFn) func(t *testing.T)
- func NewServiceNameTest(genSpans GenSpansFn, defaultName string, wantV0 ServiceNameAssertions) func(t *testing.T)
- type AssertSpansFn
- type GenSpansFn
- type ServiceNameAssertions
Constants ¶
const ( // TestDDService is a constant used in the test returned by NewServiceNameTest to set the value of DD_SERVICE. TestDDService = "dd-service" // TestServiceOverride is a constant used in the test returned by NewServiceNameTest to set the value of // the integration's WithServiceName option. TestServiceOverride = "service-override" )
Variables ¶
This section is empty.
Functions ¶
func NewKafkaOpNameTest ¶
func NewKafkaOpNameTest(genSpans GenSpansFn) func(t *testing.T)
NewKafkaOpNameTest generates a new test for span kafka operation names using the naming schema versioning.
func NewOpNameTest ¶
func NewOpNameTest(genSpans GenSpansFn, assertV0 AssertSpansFn, assertV1 AssertSpansFn) func(t *testing.T)
NewOpNameTest returns a new test that runs the provided assertion functions for each schema version.
func NewServiceNameTest ¶
func NewServiceNameTest(genSpans GenSpansFn, defaultName string, wantV0 ServiceNameAssertions) func(t *testing.T)
NewServiceNameTest generates a new test for span service names using the naming schema versioning.
Types ¶
type AssertSpansFn ¶
type AssertSpansFn func(t *testing.T, spans []mocktracer.Span)
AssertSpansFn allows to make assertions on the generated spans.
type GenSpansFn ¶
type GenSpansFn func(t *testing.T, serviceOverride string) []mocktracer.Span
GenSpansFn is used across different functions from this package to generate spans. It should be implemented in the tests that use this package. The provided serviceOverride string should be used to set the specific integration's WithServiceName option (if available) when initializing and configuring the package.
type ServiceNameAssertions ¶
type ServiceNameAssertions struct { // WithDefaults is used for the test case where defaults are used. WithDefaults []string // WithDDService is used when the global DD_SERVICE configuration is enabled (in this case, the test will set the // value to TestDDService from this package). WithDDService []string // WithDDServiceAndOverride is used for the test case where the global DD_SERVICE configuration is enabled and the // contrib specific `WithServiceName` option is used (in this case, the test will set DD_SERVICE and serviceOverride // to the TestDDService and TestServiceOverride constants from this package, respectively). WithDDServiceAndOverride []string }
ServiceNameAssertions contains assertions for different test cases used inside the generated test from NewServiceNameTest. []string fields in this struct represent the assertions to be made against the returned []mocktracer.Span from GenSpansFn in the same order.