Skip to content

Commit

Permalink
Check errs in registry_test
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed May 31, 2022
1 parent 1f54df0 commit 0e495e2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions propagators/autoprop/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"go.opentelemetry.io/otel/propagation"
)
Expand All @@ -27,7 +28,9 @@ var noop = propagation.NewCompositeTextMapPropagator()

func TestRegistryEmptyStore(t *testing.T) {
r := registry{}
assert.NotPanics(t, func() { r.store("first", noop) })
assert.NotPanics(t, func() {
require.NoError(t, r.store("first", noop))
})
}

func TestRegistryEmptyLoad(t *testing.T) {
Expand All @@ -43,10 +46,14 @@ func TestRegistryConcurrentSafe(t *testing.T) {
const propName = "prop"

r := registry{}
assert.NotPanics(t, func() { r.store(propName, noop) })
assert.NotPanics(t, func() {
require.NoError(t, r.store(propName, noop))
})

go func() {
assert.NotPanics(t, func() { r.store(propName, noop) })
assert.NotPanics(t, func() {
require.ErrorIs(t, r.store(propName, noop), errDupReg)
})
}()

go func() {
Expand Down

0 comments on commit 0e495e2

Please sign in to comment.