This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Daniel Rammer <[email protected]>
- Loading branch information
Showing
3 changed files
with
57 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package telemetryutils | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestRegisterTracerProvider(t *testing.T) { | ||
serviceName := "foo" | ||
|
||
// register tracer provider with no exporters | ||
emptyConfig := Config{} | ||
err := RegisterTracerProvider(serviceName, &emptyConfig) | ||
assert.Nil(t, err) | ||
|
||
// validate no tracerProviders are registered | ||
assert.Len(t, tracerProviders, 0) | ||
|
||
// register tracer provider with all exporters | ||
fullConfig := Config{ | ||
FileConfig: FileConfig{ | ||
Enabled: true, | ||
Filename: "/dev/null", | ||
}, | ||
JaegerConfig: JaegerConfig{ | ||
Enabled: true, | ||
}, | ||
} | ||
err = RegisterTracerProvider(serviceName, &fullConfig) | ||
assert.Nil(t, err) | ||
|
||
// validate tracerProvider is registered | ||
assert.Len(t, tracerProviders, 1) | ||
} | ||
|
||
func TestNewSpan(t *testing.T) { | ||
ctx := context.TODO() | ||
_, span := NewSpan(ctx, "bar", "baz/bat") | ||
span.End() | ||
} |
This file was deleted.
Oops, something went wrong.