1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-10-31 00:07:40 +02:00

rename to make the tests more relevant

This commit is contained in:
Stefan Prisca
2020-05-01 13:53:05 +02:00
parent 1bd88dc455
commit 54f5c350a8

View File

@@ -57,36 +57,36 @@ func (mm *mockProtoMessage) Reset() {}
func (mm *mockProtoMessage) String() string { return "mock" }
func (mm *mockProtoMessage) ProtoMessage() {}
func TestUCIFullyQualifiedMethodNameExtractsServiceName(t *testing.T) {
func TestUCIFullyQualifiedMethodNameSetsServiceNameAttribute(t *testing.T) {
expectedServiceName := "serviceName"
fullyQualifiedName := fmt.Sprintf("/foo.%s/bar", expectedServiceName)
testUCIExtractsExpectedName(t, fullyQualifiedName, expectedServiceName)
testUCISetsExpectedNameAttribute(t, fullyQualifiedName, expectedServiceName)
}
func TestUCISimpleMethodNameExtractsServiceName(t *testing.T) {
func TestUCISimpleMethodNameSetsServiceNameAttribute(t *testing.T) {
expectedServiceName := "serviceName"
simpleName := fmt.Sprintf("/%s/bar", expectedServiceName)
testUCIExtractsExpectedName(t, simpleName, expectedServiceName)
testUCISetsExpectedNameAttribute(t, simpleName, expectedServiceName)
}
func TestUCIUnamedMethodServiceExtractsEmptyName(t *testing.T) {
func TestUCIUnamedMethodSetsEmptyNameAttribute(t *testing.T) {
expectedServiceName := ""
emptyName := fmt.Sprintf("/%s/bar", expectedServiceName)
testUCIExtractsExpectedName(t, emptyName, expectedServiceName)
testUCISetsExpectedNameAttribute(t, emptyName, expectedServiceName)
}
func TestUCILongMethodNameExtractsServiceName(t *testing.T) {
func TestUCILongMethodNameSetsServiceNameAttribute(t *testing.T) {
expectedServiceName := "serviceName"
emptyServiceFullName := fmt.Sprintf("/github.com/foo.baz/bar/foo.%s/bar", expectedServiceName)
testUCIExtractsExpectedName(t, emptyServiceFullName, expectedServiceName)
testUCISetsExpectedNameAttribute(t, emptyServiceFullName, expectedServiceName)
}
func testUCIExtractsExpectedName(t *testing.T, fullServiceName, expectedServiceName string) {
func testUCISetsExpectedNameAttribute(t *testing.T, fullServiceName, expectedServiceName string) {
exp := &testExporter{make(map[string][]*export.SpanData)}
tp, _ := sdktrace.NewProvider(sdktrace.WithSyncer(exp), sdktrace.WithConfig(sdktrace.Config{DefaultSampler: sdktrace.AlwaysSample()}))
global.SetTraceProvider(tp)