Fix race condition in timeout assertion test (#1124)
Some checks failed
Post / coverage (push) Failing after 40m17s
Post / images (amd64, addon-manager) (push) Failing after 9m11s
Post / images (amd64, placement) (push) Failing after 7m57s
Post / images (amd64, registration) (push) Failing after 7m45s
Post / images (amd64, registration-operator) (push) Failing after 7m47s
Post / images (amd64, work) (push) Failing after 7m59s
Post / images (arm64, addon-manager) (push) Failing after 7m51s
Post / images (arm64, placement) (push) Failing after 7m51s
Post / images (arm64, registration) (push) Failing after 7m49s
Post / images (arm64, registration-operator) (push) Failing after 7m42s
Post / images (arm64, work) (push) Failing after 8m16s
Post / image manifest (addon-manager) (push) Has been skipped
Post / image manifest (placement) (push) Has been skipped
Post / image manifest (registration) (push) Has been skipped
Post / image manifest (registration-operator) (push) Has been skipped
Post / image manifest (work) (push) Has been skipped
Post / trigger clusteradm e2e (push) Has been skipped
Scorecard supply-chain security / Scorecard analysis (push) Failing after 1m39s
Close stale issues and PRs / stale (push) Successful in 53s

Signed-off-by: Qing Hao <qhao@redhat.com>
This commit is contained in:
Qing Hao
2025-08-13 14:08:39 +08:00
committed by GitHub
parent 3df894dc84
commit 2552f574a4

View File

@@ -354,20 +354,25 @@ func assertClusterManagementAddOnNoConditions(name string, start metav1.Time, du
return err
}
for i, ec := range expect {
cond := meta.FindStatusCondition(actual.Status.InstallProgressions[i].Conditions, ec.Type)
elapsedTime := metav1.Now().Sub(start.Time)
if cond != nil &&
cond.Status == ec.Status &&
cond.Reason == ec.Reason &&
cond.Message == ec.Message &&
metav1.Now().Sub(start.Time) < duration {
return fmt.Errorf("unexpected condition matches before duration")
// Only check if we haven't reached the expected timeout duration yet
if elapsedTime < duration {
for i, ec := range expect {
cond := meta.FindStatusCondition(actual.Status.InstallProgressions[i].Conditions, ec.Type)
// The expected timeout condition should NOT appear before the duration
if cond != nil &&
cond.Status == ec.Status &&
cond.Reason == ec.Reason &&
cond.Message == ec.Message {
return fmt.Errorf("unexpected condition matches before duration (elapsed: %v, expected: %v)", elapsedTime, duration)
}
}
}
return nil
}, duration, eventuallyInterval).Should(gomega.BeNil())
}, duration+2*time.Second, eventuallyInterval).Should(gomega.BeNil())
}
func assertManagedClusterAddOnConfigReferences(name, namespace string, expect ...addonapiv1alpha1.ConfigReference) {