Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[chore] remove use of ReportFatalError in test #31794

Merged
merged 2 commits into from Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 2 additions & 16 deletions extension/observer/dockerobserver/integration_test.go
Expand Up @@ -16,24 +16,12 @@ import (
"github.com/stretchr/testify/require"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer"
)

type testHost struct {
component.Host
t *testing.T
}

// ReportFatalError causes the test to be run to fail.
func (h *testHost) ReportFatalError(err error) {
h.t.Fatalf("Receiver reported a fatal error: %v", err)
}

var _ component.Host = (*testHost)(nil)

func TestObserverEmitsEndpointsIntegration(t *testing.T) {
image := "docker.io/library/nginx"
tag := "1.17"
Expand Down Expand Up @@ -226,9 +214,7 @@ func startObserverWithConfig(t *testing.T, listener observer.Notify, c *Config)
obvs, ok := ext.(*dockerObserver)
require.True(t, ok)
require.NoError(t, err, "failed creating extension")
require.NoError(t, obvs.Start(ctx, &testHost{
t: t,
}))
require.NoError(t, obvs.Start(ctx, componenttest.NewNopHost()))

go obvs.ListAndWatch(listener)
return obvs
Expand Down