diff --git a/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go b/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go index e028205fd3a..7bfc5d90bba 100644 --- a/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go +++ b/internal/pkg/agent/application/gateway/fleet/fleet_gateway.go @@ -198,7 +198,13 @@ func (f *FleetGateway) doExecute(ctx context.Context, bo backoff.Backoff) (*flee } if !bo.Wait() { - // Something bad has happened and we log it and we should update our current state. + if ctx.Err() != nil { + // if the context is cancelled, break out of the loop + break + } + + // This should not really happen, but just in-case this error is used to show that + // something strange occurred and we want to log it and report it. err := errors.New( "checkin retry loop was stopped", errors.TypeNetwork, diff --git a/testing/integration/endpoint_security_test.go b/testing/integration/endpoint_security_test.go index bcda661ca95..6a713a42730 100644 --- a/testing/integration/endpoint_security_test.go +++ b/testing/integration/endpoint_security_test.go @@ -275,11 +275,6 @@ func testInstallAndUnenrollWithEndpointSecurity(t *testing.T, info *define.Info, return false } - if state.FleetState != client.Failed { - t.Logf("Fleet state has not been marked as failed yet!\n%+v", state) - return false - } - return true }, endpointHealthPollingTimeout, diff --git a/testing/integration/linux_rpm_test.go b/testing/integration/linux_rpm_test.go index 0f49e306996..4f5c6fc38aa 100644 --- a/testing/integration/linux_rpm_test.go +++ b/testing/integration/linux_rpm_test.go @@ -44,8 +44,6 @@ func TestRpmLogIngestFleetManaged(t *testing.T) { Sudo: true, }) - t.Skip("Flaky https://github.com/elastic/elastic-agent/issues/5311") - ctx, cancel := testcontext.WithDeadline(t, context.Background(), time.Now().Add(10*time.Minute)) defer cancel()