-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
2 changed files
with
52 additions
and
2 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 |
---|---|---|
@@ -1,12 +1,32 @@ | ||
package telemetry | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
"go.opentelemetry.io/otel/sdk/metric" | ||
) | ||
|
||
func TestTelemetry_Creation(t *testing.T) { | ||
_, err := NewTelemetry(DefaultConfig()) | ||
require.NoError(t, err) | ||
} | ||
|
||
func TestDefaults_noopExporters(t *testing.T) { | ||
// By default all otel providers must be noop. Since we don't have otel setup | ||
// in test environment, this test ensures all providers are noop. | ||
mr, err := newMetricReader() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
// ensures we have a noop metric.ManualReader | ||
_ = mr.(*metric.ManualReader).Shutdown(context.Background()) | ||
|
||
se, err := newSpanExporter() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
// ensures we have a noopSpanExporter | ||
_ = se.(noopSpanExporter).Shutdown(context.Background()) | ||
} |