Skip to content

Commit

Permalink
Tests: check DiscoveryFetch events before creating resource (#36008)
Browse files Browse the repository at this point in the history
After creating a DiscoveryConfig with valid matchers, the
DiscoveryService will fetch Cloud Resources and emit a
DiscoveryFetchEvent.

The test was asserting that the number of FetchEvents was zero right
after creating the DiscoveryConfig, but it might happen that between the
CreateDiscoveryConfig and reading the DiscoveryFetchEventCount, the
DiscoveryConfig was processed, a new fetch was triggered and an event
emitted.

This PR moves the check to before the CreateDiscoveryConfig call.
  • Loading branch information
marcoandredinis authored Dec 23, 2023
1 parent fc81024 commit 6c9bf5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/srv/discovery/discovery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1930,9 +1930,9 @@ func TestDiscoveryDatabaseRemovingDiscoveryConfigs(t *testing.T) {
)
require.NoError(t, err)

require.Zero(t, reporter.DiscoveryFetchEventCount())
_, err = tlsServer.Auth().DiscoveryConfigClient().CreateDiscoveryConfig(ctx, dc1)
require.NoError(t, err)
require.Zero(t, reporter.DiscoveryFetchEventCount())

// Check for new resource in reconciler
expectDatabases := []types.Database{awsRDSDB}
Expand Down

0 comments on commit 6c9bf5e

Please sign in to comment.