From c81101a9e79787f01d269be0703b6fc6815fc854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paolo=20Chil=C3=A0?= Date: Wed, 5 Mar 2025 12:25:57 +0100 Subject: [PATCH] Increase timeout for assertions in TestSetLogLevelFleetManaged (#7190) Fleet checkins may take up to 5 minutes so we need to increase timeouts for assertions in TestSetLogLevelFleetManaged to account for it as the agent may apply log level settings while there's already a Fleet check-in in progress. Settings timeouts for retrieving the correct log level in Fleet to 6 minutes should give enough time to agent to set the log level and communicate it to Fleet in a new check-in request. (cherry picked from commit 12fa5571af13be8c419a6401645867af518671c2) --- testing/integration/log_level_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/testing/integration/log_level_test.go b/testing/integration/log_level_test.go index ac77e9c77a0..f1ee2524707 100644 --- a/testing/integration/log_level_test.go +++ b/testing/integration/log_level_test.go @@ -40,7 +40,7 @@ func TestSetLogLevelFleetManaged(t *testing.T) { Sudo: true, }) - deadline := time.Now().Add(10 * time.Minute) + deadline := time.Now().Add(30 * time.Minute) ctx, cancel := testcontext.WithDeadline(t, context.Background(), deadline) defer cancel() @@ -114,7 +114,7 @@ func testLogLevelSetViaFleet(ctx context.Context, f *atesting.Fixture, agentID s } t.Logf("Fleet metadata log level for agent %q: %q policy log level: %q", agentID, fleetMetadataLogLevel, policyLogLevel) return fleetMetadataLogLevel == policyLogLevel.String() - }, 30*time.Second, time.Second, "agent never communicated policy log level %q to Fleet", policyLogLevel) + }, 6*time.Minute, 30*time.Second, "agent never communicated policy log level %q to Fleet", policyLogLevel) // Step 2: set a different log level for the specific agent using Settings action // set agent log level and verify that it takes precedence over the policy one @@ -145,7 +145,7 @@ func testLogLevelSetViaFleet(ctx context.Context, f *atesting.Fixture, agentID s } t.Logf("Fleet metadata log level for agent %q: %q agent log level: %q", agentID, fleetMetadataLogLevel, agentLogLevel) return fleetMetadataLogLevel == agentLogLevel - }, 30*time.Second, time.Second, "agent never communicated agent-specific log level %q to Fleet", agentLogLevel) + }, 6*time.Minute, 30*time.Second, "agent never communicated agent-specific log level %q to Fleet", agentLogLevel) // Step 3: Clear the agent-specific log level override, verify that we revert to policy log level t.Logf("Clearing agent log level, expecting log level to revert back to %q", policyLogLevel) @@ -173,7 +173,7 @@ func testLogLevelSetViaFleet(ctx context.Context, f *atesting.Fixture, agentID s } t.Logf("Fleet metadata log level for agent %q: %q policy log level: %q", agentID, fleetMetadataLogLevel, policyLogLevel) return fleetMetadataLogLevel == policyLogLevel.String() - }, 30*time.Second, time.Second, "agent never communicated reverting to policy log level %q to Fleet", policyLogLevel) + }, 6*time.Minute, 30*time.Second, "agent never communicated reverting to policy log level %q to Fleet", policyLogLevel) // Step 4: Clear the log level in policy and verify that agent reverts to the initial log level t.Logf("Clearing policy log level, expecting log level to revert back to %q", initialLogLevel) @@ -201,7 +201,7 @@ func testLogLevelSetViaFleet(ctx context.Context, f *atesting.Fixture, agentID s } t.Logf("Fleet metadata log level for agent %q: %q initial log level: %q", agentID, fleetMetadataLogLevel, initialLogLevel) return fleetMetadataLogLevel == initialLogLevel - }, 30*time.Second, time.Second, "agent never communicated initial log level %q to Fleet", initialLogLevel) + }, 6*time.Minute, 30*time.Second, "agent never communicated initial log level %q to Fleet", initialLogLevel) } func waitForAgentAndFleetHealthy(ctx context.Context, t *testing.T, f *atesting.Fixture) bool {