-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathspan_test.go
More file actions
39 lines (33 loc) · 834 Bytes
/
span_test.go
File metadata and controls
39 lines (33 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package goagent
import (
"context"
"testing"
"time"
"github.com/Traceableai/goagent/config"
"github.com/Traceableai/goagent/hypertrace/goagent/instrumentation/opentelemetry"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestStartSpan(t *testing.T) {
cfg := config.Load()
shutdown := Init(cfg)
defer shutdown()
_, s, ender := StartSpan(
context.Background(),
"test",
WithSpanKind(SpanKindClient),
WithTimestamp(time.Now()),
)
defer ender()
assert.False(t, s.IsNoop())
}
func TestRegisterService(t *testing.T) {
cfg := config.Load()
shutdown := Init(cfg)
defer shutdown()
ss, tp, err := RegisterService("myservice", nil)
require.NoError(t, err)
assert.NotEqual(t, opentelemetry.NoopTracerProvider(), tp)
_, _, closer := ss(context.Background(), "test")
closer()
}