Chore: Make test tracer noop and return no errors (#50797)
This commit is contained in:
+12
-24
@@ -14,9 +14,7 @@ type testQuery struct {
|
||||
}
|
||||
|
||||
func TestEventPublish(t *testing.T) {
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
bus := ProvideBus(tracer)
|
||||
bus := ProvideBus(tracing.InitializeTracerForTest())
|
||||
|
||||
var invoked bool
|
||||
|
||||
@@ -25,25 +23,21 @@ func TestEventPublish(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
|
||||
err = bus.Publish(context.Background(), &testQuery{})
|
||||
err := bus.Publish(context.Background(), &testQuery{})
|
||||
require.NoError(t, err, "unable to publish event")
|
||||
|
||||
require.True(t, invoked)
|
||||
}
|
||||
|
||||
func TestEventPublish_NoRegisteredListener(t *testing.T) {
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
bus := ProvideBus(tracer)
|
||||
bus := ProvideBus(tracing.InitializeTracerForTest())
|
||||
|
||||
err = bus.Publish(context.Background(), &testQuery{})
|
||||
err := bus.Publish(context.Background(), &testQuery{})
|
||||
require.NoError(t, err, "unable to publish event")
|
||||
}
|
||||
|
||||
func TestEventCtxPublishCtx(t *testing.T) {
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
bus := ProvideBus(tracer)
|
||||
bus := ProvideBus(tracing.InitializeTracerForTest())
|
||||
|
||||
var invoked bool
|
||||
|
||||
@@ -52,25 +46,21 @@ func TestEventCtxPublishCtx(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
|
||||
err = bus.Publish(context.Background(), &testQuery{})
|
||||
err := bus.Publish(context.Background(), &testQuery{})
|
||||
require.NoError(t, err, "unable to publish event")
|
||||
|
||||
require.True(t, invoked)
|
||||
}
|
||||
|
||||
func TestEventPublishCtx_NoRegisteredListener(t *testing.T) {
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
bus := ProvideBus(tracer)
|
||||
bus := ProvideBus(tracing.InitializeTracerForTest())
|
||||
|
||||
err = bus.Publish(context.Background(), &testQuery{})
|
||||
err := bus.Publish(context.Background(), &testQuery{})
|
||||
require.NoError(t, err, "unable to publish event")
|
||||
}
|
||||
|
||||
func TestEventPublishCtx(t *testing.T) {
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
bus := ProvideBus(tracer)
|
||||
bus := ProvideBus(tracing.InitializeTracerForTest())
|
||||
|
||||
var invoked bool
|
||||
|
||||
@@ -79,16 +69,14 @@ func TestEventPublishCtx(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
|
||||
err = bus.Publish(context.Background(), &testQuery{})
|
||||
err := bus.Publish(context.Background(), &testQuery{})
|
||||
require.NoError(t, err, "unable to publish event")
|
||||
|
||||
require.True(t, invoked)
|
||||
}
|
||||
|
||||
func TestEventCtxPublish(t *testing.T) {
|
||||
tracer, err := tracing.InitializeTracerForTest()
|
||||
require.NoError(t, err)
|
||||
bus := ProvideBus(tracer)
|
||||
bus := ProvideBus(tracing.InitializeTracerForTest())
|
||||
|
||||
var invoked bool
|
||||
|
||||
@@ -97,7 +85,7 @@ func TestEventCtxPublish(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
|
||||
err = bus.Publish(context.Background(), &testQuery{})
|
||||
err := bus.Publish(context.Background(), &testQuery{})
|
||||
require.NoError(t, err, "unable to publish event")
|
||||
|
||||
require.True(t, invoked)
|
||||
|
||||
Reference in New Issue
Block a user