From d1386646a1ecc0fcd2fd81cd7d1c34934c0e00cd Mon Sep 17 00:00:00 2001 From: Gavin Frazar Date: Wed, 15 Jan 2025 14:58:46 -0800 Subject: [PATCH] Fix TestWatcherCloudFetchers flakiness (#51088) --- lib/srv/db/watcher_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/srv/db/watcher_test.go b/lib/srv/db/watcher_test.go index 6c94e201de177..0e32ebbb41e08 100644 --- a/lib/srv/db/watcher_test.go +++ b/lib/srv/db/watcher_test.go @@ -332,6 +332,16 @@ func TestWatcherCloudFetchers(t *testing.T) { testCtx.setupDatabaseServer(ctx, t, agentParams{ // Keep ResourceMatchers as nil to disable resource matchers. OnReconcile: func(d types.Databases) { + if len(d) == 0 { + // The dynamic resource matchers and cloud watchers will both + // trigger a reconciliation, but dynamic matchers should return + // 0 resources from first init, whereas the cloud watchers + // should return databases. + // Dynamic matchers are included in config to test that the + // dynamic matcher AWS settings are not applied to cloud watcher + // databases. + return + } reconcileCh <- d }, ResourceMatchers: []services.ResourceMatcher{{