Skip to content

Commit f0cdc82

Browse files
authored
fix: flakey tests due to parallelism (#692)
* fix: flakey tests due to parrelleism Signed-off-by: Zach Aller <[email protected]> * fix: UI cve Signed-off-by: Zach Aller <[email protected]> * fix: UI cve Signed-off-by: Zach Aller <[email protected]> --------- Signed-off-by: Zach Aller <[email protected]>
1 parent aeebfa0 commit f0cdc82

File tree

6 files changed

+57
-14
lines changed

6 files changed

+57
-14
lines changed

internal/controller/promotionstrategy_controller_test.go

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,12 +857,41 @@ var _ = Describe("PromotionStrategy Controller", func() {
857857
Expect(conflictingSha).NotTo(BeEmpty())
858858

859859
By("Checking that there is no previous-environment commit status created, since no active checks are configured")
860+
// List all CTPs owned by this test's PromotionStrategy
861+
ctpList := promoterv1alpha1.ChangeTransferPolicyList{}
862+
err = k8sClient.List(ctx, &ctpList, client.InNamespace(typeNamespacedName.Namespace))
863+
Expect(err).NotTo(HaveOccurred())
864+
865+
// Build a set of CTP UIDs that belong to this test's PromotionStrategy, so that we can continue to run tests
866+
// in parallel without interfering with each other.
867+
ctpUIDs := make(map[string]bool)
868+
for _, ctp := range ctpList.Items {
869+
for _, ownerRef := range ctp.OwnerReferences {
870+
if ownerRef.Name == promotionStrategy.Name && ownerRef.UID == promotionStrategy.UID {
871+
ctpUIDs[string(ctp.UID)] = true
872+
break
873+
}
874+
}
875+
}
876+
877+
// List all previous-environment commit statuses and filter by ownership
860878
csList := promoterv1alpha1.CommitStatusList{}
861879
err = k8sClient.List(ctx, &csList, client.MatchingLabels{
862880
promoterv1alpha1.CommitStatusLabel: promoterv1alpha1.PreviousEnvironmentCommitStatusKey,
863881
})
864882
Expect(err).NotTo(HaveOccurred())
865-
Expect(len(csList.Items)).To(Equal(0))
883+
884+
// Filter to only include commit statuses owned by this test's CTPs
885+
testCommitStatuses := 0
886+
for _, cs := range csList.Items {
887+
for _, ownerRef := range cs.OwnerReferences {
888+
if ctpUIDs[string(ownerRef.UID)] {
889+
testCommitStatuses++
890+
break
891+
}
892+
}
893+
}
894+
Expect(testCommitStatuses).To(Equal(0))
866895

867896
By("Waiting for CTPs to reconcile after the conflict and verifying conflict resolution")
868897
Eventually(func(g Gomega) {

ui/components-lib/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/components-lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"dependencies": {
1212
"@types/js-yaml": "^4.0.9",
1313
"ace-builds": "^1.43.2",
14-
"js-yaml": "^4.1.0",
14+
"js-yaml": "^4.1.1",
1515
"react": "18.3.1",
1616
"react-ace": "^14.0.1",
1717
"react-dom": "18.3.1",

ui/dashboard/package-lock.json

Lines changed: 16 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/extension/package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"dependencies": {
3535
"@types/js-yaml": "^4.0.9",
3636
"axios": "^1.12.0",
37-
"js-yaml": "^4.1.0",
37+
"js-yaml": "^4.1.1",
3838
"react": "18.3.1",
3939
"react-dom": "18.3.1",
4040
"zustand": "^3.7.2"

0 commit comments

Comments
 (0)