mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-02-14 18:09:57 +00:00
fix: correct variable usage and error messages in ManifestWorkReplicaSet e2e tests (#1386)
This commit fixes two bugs in the ManifestWorkReplicaSet e2e tests: 1. Use freshly fetched mwrSet instead of stale mwReplicaSet when checking status summary. This ensures we're validating against the latest state rather than the initial object. 2. Return descriptive error messages instead of nil error when condition checks fail. This improves test debugging by providing clear failure reasons. These fixes improve test reliability and error reporting. 🤖 Assisted by Claude Code Signed-off-by: $(git config user.name) <$(git config user.email)> Signed-off-by: zhujian <jiazhu@redhat.com>
This commit is contained in:
@@ -301,11 +301,11 @@ var _ = ginkgo.Describe("Test ManifestWorkReplicaSet", ginkgo.Label("manifestwor
|
||||
}
|
||||
|
||||
if !meta.IsStatusConditionTrue(mwrSet.Status.Conditions, workapiv1alpha1.ManifestWorkReplicaSetConditionPlacementVerified) {
|
||||
return err
|
||||
return fmt.Errorf("manifestwork replicaset PlacementVerified condition is not true")
|
||||
}
|
||||
|
||||
if mwReplicaSet.Status.Summary.Total != numOfClusters {
|
||||
return fmt.Errorf("total number of clusters is not correct, expect %d, got %d", numOfClusters, mwReplicaSet.Status.Summary.Total)
|
||||
if mwrSet.Status.Summary.Total != numOfClusters {
|
||||
return fmt.Errorf("total number of clusters is not correct, expect %d, got %d", numOfClusters, mwrSet.Status.Summary.Total)
|
||||
}
|
||||
return nil
|
||||
}).Should(gomega.Succeed())
|
||||
@@ -388,11 +388,11 @@ var _ = ginkgo.Describe("Test ManifestWorkReplicaSet", ginkgo.Label("manifestwor
|
||||
}
|
||||
|
||||
if !meta.IsStatusConditionTrue(mwrSet.Status.Conditions, workapiv1alpha1.ManifestWorkReplicaSetConditionPlacementVerified) {
|
||||
return err
|
||||
return fmt.Errorf("manifestwork replicaset PlacementVerified condition is not true")
|
||||
}
|
||||
|
||||
if mwReplicaSet.Status.Summary.Total != numOfClusters {
|
||||
return fmt.Errorf("total number of clusters is not correct, expect %d, got %d", numOfClusters, mwReplicaSet.Status.Summary.Total)
|
||||
if mwrSet.Status.Summary.Total != numOfClusters {
|
||||
return fmt.Errorf("total number of clusters is not correct, expect %d, got %d", numOfClusters, mwrSet.Status.Summary.Total)
|
||||
}
|
||||
return nil
|
||||
}).Should(gomega.Succeed())
|
||||
|
||||
Reference in New Issue
Block a user