Skip to content

Commit

Permalink
[chore] remove mock host impl, use componenttest.NewNopHost instead (o…
Browse files Browse the repository at this point in the history
  • Loading branch information
atoulme authored and f7o committed Sep 12, 2024
1 parent 06abd5c commit a428f7c
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions exporter/rabbitmqexporter/rabbitmq_exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ func TestStart_UnknownMarshallerEncoding(t *testing.T) {

unknownExtensionID := component.NewID(component.MustNewType("invalid_encoding"))
cfg.EncodingExtensionID = &unknownExtensionID
host := mockHost{}
exporter := newRabbitmqExporter(cfg, exportertest.NewNopSettings().TelemetrySettings, pubFactory, newTLSFactory(cfg), routingKey, connectionName)

err := exporter.start(context.Background(), host)
err := exporter.start(context.Background(), componenttest.NewNopHost())
assert.EqualError(t, err, "unknown encoding \"invalid_encoding\"")

err = exporter.shutdown(context.Background())
Expand Down Expand Up @@ -162,11 +161,3 @@ func (c *mockPublisher) Close() error {
args := c.Called()
return args.Error(0)
}

type mockHost struct {
component.Host
}

func (h mockHost) GetExtensions() map[component.ID]component.Component {
return make(map[component.ID]component.Component)
}

0 comments on commit a428f7c

Please sign in to comment.