Repository: kubernetes-sigs/kueue

Issue:
Implement generic strings Join util
<!-- Please only use this template for submitting clean up requests -->

**What would you like to be cleaned**:

I would like to implement a generic string `Join` util in https://github.com/kubernetes-sigs/kueue/tree/main/pkg/util/strings

```go
func Join[S ~string](a S, sep string) S { ... }
```

This has the same functionality with Go stdlib `strings.Join`, but this allows us to use strings type alias.

**Why is this needed**:

We have a lot of strings type alias and join those for messaging like:

- https://github.com/kubernetes-sigs/kueue/blob/b90208f86e490ef499bcfcc6d0b1242f5d880fae/pkg/config/validation.go#L277
- https://github.com/kubernetes-sigs/kueue/blob/04bee0db4000b298656c42a1ec44493e49bab5c8/pkg/cache/clusterqueue.go#L255

So, we want to generalize those.

Discussion:
@vladikkuzn: /assign

Solution patch:
diff --git a/pkg/cache/clusterqueue.go b/pkg/cache/clusterqueue.go
index c571f5341..925051de7 100644
--- a/pkg/cache/clusterqueue.go
+++ b/pkg/cache/clusterqueue.go
@@ -229,15 +229,15 @@ func (c *clusterQueue) inactiveReason() (string, string) {
 		}
 		if len(c.missingFlavors) > 0 {
 			reasons = append(reasons, kueue.ClusterQueueActiveReasonFlavorNotFound)
-			messages = append(messages, fmt.Sprintf("references missing ResourceFlavor(s): %v", c.missingFlavors))
+			messages = append(messages, fmt.Sprintf("references missing ResourceFlavor(s): %v", stringsutils.Join(c.missingFlavors, ",")))
 		}
 		if len(c.missingAdmissionChecks) > 0 {
 			reasons = append(reasons, kueue.ClusterQueueActiveReasonAdmissionCheckNotFound)
-			messages = append(messages, fmt.Sprintf("references missing AdmissionCheck(s): %v", c.missingAdmissionChecks))
+			messages = append(messages, fmt.Sprintf("references missing AdmissionCheck(s): %v", stringsutils.Join(c.missingAdmissionChecks, ",")))
 		}
 		if len(c.inactiveAdmissionChecks) > 0 {
 			reasons = append(reasons, kueue.ClusterQueueActiveReasonAdmissionCheckInactive)
-			messages = append(messages, fmt.Sprintf("references inactive AdmissionCheck(s): %v", c.inactiveAdmissionChecks))
+			messages = append(messages, fmt.Sprintf("references inactive AdmissionCheck(s): %v", stringsutils.Join(c.inactiveAdmissionChecks, ",")))
 		}
 
 		if len(c.multiKueueAdmissionChecks) > 1 {
@@ -271,7 +271,7 @@ func (c *clusterQueue) inactiveReason() (string, string) {
 			return kueue.ClusterQueueActiveReasonUnknown, "Can't admit new workloads."
 		}
 
-		return reasons[0], api.TruncateConditionMessage(strings.Join([]string{"Can't admit new workloads: ", strings.Join(messages, ", "), "."}, ""))
+		return reasons[0], api.TruncateConditionMessage(fmt.Sprintf("Can't admit new workloads: %v.", strings.Join(messages, ", ")))
 	}
 	return kueue.ClusterQueueActiveReasonReady, "Can admit new workloads"
 }
diff --git a/pkg/config/validation.go b/pkg/config/validation.go
index b4f0fab4e..9637f6d54 100644
--- a/pkg/config/validation.go
+++ b/pkg/config/validation.go
@@ -21,7 +21,6 @@ import (
 	"fmt"
 	"slices"
 	"strings"
-	"unsafe"
 
 	corev1 "k8s.io/api/core/v1"
 	apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation"
@@ -40,6 +39,7 @@ import (
 	"sigs.k8s.io/kueue/pkg/controller/jobframework"
 	podworkload "sigs.k8s.io/kueue/pkg/controller/jobs/pod"
 	"sigs.k8s.io/kueue/pkg/features"
+	stringsutils "sigs.k8s.io/kueue/pkg/util/strings"
 )
 
 const (
@@ -272,9 +272,7 @@ var (
 	validStrategySetsStr = func() []string {
 		var ss []string
 		for _, s := range validStrategySets {
-			// Casting because strings.Join requires a slice of strings
-			strategies := *(*[]string)(unsafe.Pointer(&s))
-			ss = append(ss, strings.Join(strategies, ","))
+			ss = append(ss, stringsutils.Join(s, ","))
 		}
 		return ss
 	}()
diff --git a/pkg/controller/core/workload_controller.go b/pkg/controller/core/workload_controller.go
index a230655b8..2799c6cc4 100644
--- a/pkg/controller/core/workload_controller.go
+++ b/pkg/controller/core/workload_controller.go
@@ -56,6 +56,7 @@ import (
 	"sigs.k8s.io/kueue/pkg/queue"
 	"sigs.k8s.io/kueue/pkg/util/admissioncheck"
 	utilslices "sigs.k8s.io/kueue/pkg/util/slices"
+	stringsutils "sigs.k8s.io/kueue/pkg/util/strings"
 	"sigs.k8s.io/kueue/pkg/workload"
 )
 
@@ -385,7 +386,7 @@ func (r *WorkloadReconciler) reconcileCheckBasedEviction(ctx context.Context, wl
 		for _, check := range workload.RejectedChecks(wl) {
 			rejectedCheckNames = append(rejectedCheckNames, check.Name)
 		}
-		workload.SetDeactivationTarget(wl, kueue.WorkloadEvictedByAdmissionCheck, fmt.Sprintf("Admission check(s): %v, were rejected", rejectedCheckNames))
+		workload.SetDeactivationTarget(wl, kueue.WorkloadEvictedByAdmissionCheck, fmt.Sprintf("Admission check(s): %v, were rejected", stringsutils.Join(rejectedCheckNames, ",")))
 		if err := workload.ApplyAdmissionStatus(ctx, r.client, wl, true, r.clock); err != nil {
 			return false, client.IgnoreNotFound(err)
 		}



Test patch:
diff --git a/pkg/cache/cache_test.go b/pkg/cache/cache_test.go
index 3f1295b3d..84dc91268 100644
--- a/pkg/cache/cache_test.go
+++ b/pkg/cache/cache_test.go
@@ -3366,7 +3366,7 @@ func TestClusterQueueReadiness(t *testing.T) {
 			clusterQueueName: "queue1",
 			wantStatus:       metav1.ConditionFalse,
 			wantReason:       "FlavorNotFound",
-			wantMessage:      "Can't admit new workloads: references missing ResourceFlavor(s): [flavor1].",
+			wantMessage:      "Can't admit new workloads: references missing ResourceFlavor(s): flavor1.",
 		},
 		"check not found": {
 			clusterQueues:    []*kueue.ClusterQueue{baseQueue},
@@ -3374,7 +3374,7 @@ func TestClusterQueueReadiness(t *testing.T) {
 			clusterQueueName: "queue1",
 			wantStatus:       metav1.ConditionFalse,
 			wantReason:       "AdmissionCheckNotFound",
-			wantMessage:      "Can't admit new workloads: references missing AdmissionCheck(s): [check1].",
+			wantMessage:      "Can't admit new workloads: references missing AdmissionCheck(s): check1.",
 		},
 		"check inactive": {
 			clusterQueues:    []*kueue.ClusterQueue{baseQueue},
@@ -3383,14 +3383,14 @@ func TestClusterQueueReadiness(t *testing.T) {
 			clusterQueueName: "queue1",
 			wantStatus:       metav1.ConditionFalse,
 			wantReason:       "AdmissionCheckInactive",
-			wantMessage:      "Can't admit new workloads: references inactive AdmissionCheck(s): [check1].",
+			wantMessage:      "Can't admit new workloads: references inactive AdmissionCheck(s): check1.",
 		},
 		"flavor and check not found": {
 			clusterQueues:    []*kueue.ClusterQueue{baseQueue},
 			clusterQueueName: "queue1",
 			wantStatus:       metav1.ConditionFalse,
 			wantReason:       "FlavorNotFound",
-			wantMessage:      "Can't admit new workloads: references missing ResourceFlavor(s): [flavor1], references missing AdmissionCheck(s): [check1].",
+			wantMessage:      "Can't admit new workloads: references missing ResourceFlavor(s): flavor1, references missing AdmissionCheck(s): check1.",
 		},
 		"terminating": {
 			clusterQueues:    []*kueue.ClusterQueue{baseQueue},
diff --git a/pkg/cache/clusterqueue_test.go b/pkg/cache/clusterqueue_test.go
index d031330e9..f89d0288b 100644
--- a/pkg/cache/clusterqueue_test.go
+++ b/pkg/cache/clusterqueue_test.go
@@ -257,7 +257,7 @@ func TestClusterQueueUpdateWithAdmissionCheck(t *testing.T) {
 			},
 			wantStatus:  pending,
 			wantReason:  "AdmissionCheckNotFound",
-			wantMessage: "Can't admit new workloads: references missing AdmissionCheck(s): [check3].",
+			wantMessage: "Can't admit new workloads: references missing AdmissionCheck(s): check3.",
 		},
 		{
 			name:     "Active clusterQueue with an AC strategy updated with not found AC",
@@ -275,7 +275,7 @@ func TestClusterQueueUpdateWithAdmissionCheck(t *testing.T) {
 			},
 			wantStatus:  pending,
 			wantReason:  "AdmissionCheckNotFound",
-			wantMessage: "Can't admit new workloads: references missing AdmissionCheck(s): [check3].",
+			wantMessage: "Can't admit new workloads: references missing AdmissionCheck(s): check3.",
 		},
 		{
 			name:     "Active clusterQueue updated with inactive AC",
@@ -297,7 +297,7 @@ func TestClusterQueueUpdateWithAdmissionCheck(t *testing.T) {
 			},
 			wantStatus:  pending,
 			wantReason:  "AdmissionCheckInactive",
-			wantMessage: "Can't admit new workloads: references inactive AdmissionCheck(s): [check3].",
+			wantMessage: "Can't admit new workloads: references inactive AdmissionCheck(s): check3.",
 		},
 		{
 			name:     "Active clusterQueue with an AC strategy updated with inactive AC",
@@ -319,7 +319,7 @@ func TestClusterQueueUpdateWithAdmissionCheck(t *testing.T) {
 			},
 			wantStatus:  pending,
 			wantReason:  "AdmissionCheckInactive",
-			wantMessage: "Can't admit new workloads: references inactive AdmissionCheck(s): [check3].",
+			wantMessage: "Can't admit new workloads: references inactive AdmissionCheck(s): check3.",
 		},
 		{
 			name:     "Active clusterQueue with an MultiKueue AC strategy updated with duplicate single instance AC Controller",
diff --git a/pkg/controller/core/workload_controller_test.go b/pkg/controller/core/workload_controller_test.go
index 5e5bec724..bd85707fc 100644
--- a/pkg/controller/core/workload_controller_test.go
+++ b/pkg/controller/core/workload_controller_test.go
@@ -556,7 +556,7 @@ func TestReconcile(t *testing.T) {
 						Type:    kueue.WorkloadDeactivationTarget,
 						Status:  metav1.ConditionTrue,
 						Reason:  "AdmissionCheck",
-						Message: "Admission check(s): [check], were rejected",
+						Message: "Admission check(s): check, were rejected",
 					},
 				).
 				Obj(),
@@ -604,7 +604,7 @@ func TestReconcile(t *testing.T) {
 						Type:    kueue.WorkloadDeactivationTarget,
 						Status:  metav1.ConditionTrue,
 						Reason:  "AdmissionCheck",
-						Message: "Admission check(s): [check], were rejected",
+						Message: "Admission check(s): check, were rejected",
 					},
 				).
 				Obj(),
@@ -637,7 +637,7 @@ func TestReconcile(t *testing.T) {
 					Type:    kueue.WorkloadDeactivationTarget,
 					Status:  metav1.ConditionTrue,
 					Reason:  kueue.WorkloadEvictedByAdmissionCheck,
-					Message: "Admission check(s): [check-1], were rejected",
+					Message: "Admission check(s): check-1, were rejected",
 				}).
 				Obj(),
 			wantWorkload: utiltesting.MakeWorkload("wl", "ns").
@@ -662,14 +662,14 @@ func TestReconcile(t *testing.T) {
 						Type:    kueue.WorkloadEvicted,
 						Status:  metav1.ConditionTrue,
 						Reason:  "DeactivatedDueToAdmissionCheck",
-						Message: "The workload is deactivated due to Admission check(s): [check-1], were rejected",
+						Message: "The workload is deactivated due to Admission check(s): check-1, were rejected",
 					},
 					// In a real cluster this condition would be removed but it cant be in the fake cluster
 					metav1.Condition{
 						Type:    kueue.WorkloadDeactivationTarget,
 						Status:  metav1.ConditionTrue,
 						Reason:  kueue.WorkloadEvictedByAdmissionCheck,
-						Message: "Admission check(s): [check-1], were rejected",
+						Message: "Admission check(s): check-1, were rejected",
 					},
 				).
 				Obj(),
@@ -678,7 +678,7 @@ func TestReconcile(t *testing.T) {
 					Key:       types.NamespacedName{Namespace: "ns", Name: "wl"},
 					EventType: "Normal",
 					Reason:    "EvictedDueToDeactivatedDueToAdmissionCheck",
-					Message:   "The workload is deactivated due to Admission check(s): [check-1], were rejected",
+					Message:   "The workload is deactivated due to Admission check(s): check-1, were rejected",
 				},
 			},
 		},
diff --git a/pkg/util/testing/condition_matchers.go b/pkg/util/testing/condition_matchers.go
index dc7f6243f..6a3e8dad1 100644
--- a/pkg/util/testing/condition_matchers.go
+++ b/pkg/util/testing/condition_matchers.go
@@ -26,30 +26,45 @@ import (
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
-func HaveConditionStatus(conditionType string, status metav1.ConditionStatus) types.GomegaMatcher {
+func HaveConditionStatusAndReason(conditionType string, status metav1.ConditionStatus, reason string) types.GomegaMatcher {
+	if conditionType == "" {
+		panic("conditionType is empty")
+	}
 	return &conditionMatcher{
 		conditionType: conditionType,
 		status:        status,
+		reason:        reason,
 	}
 }
 
+func HaveConditionStatus(conditionType string, status metav1.ConditionStatus) types.GomegaMatcher {
+	return HaveConditionStatusAndReason(conditionType, status, "")
+}
+
 func HaveCondition(conditionType string) types.GomegaMatcher {
-	return &conditionMatcher{
-		conditionType: conditionType,
-	}
+	return HaveConditionStatusAndReason(conditionType, "", "")
 }
 
 func HaveConditionStatusTrue(conditionType string) types.GomegaMatcher {
 	return HaveConditionStatus(conditionType, metav1.ConditionTrue)
 }
 
+func HaveConditionStatusTrueAndReason(conditionType, reason string) types.GomegaMatcher {
+	return HaveConditionStatusAndReason(conditionType, metav1.ConditionTrue, reason)
+}
+
 func HaveConditionStatusFalse(conditionType string) types.GomegaMatcher {
 	return HaveConditionStatus(conditionType, metav1.ConditionFalse)
 }
 
+func HaveConditionStatusFalseAndReason(conditionType string, reason string) types.GomegaMatcher {
+	return HaveConditionStatusAndReason(conditionType, metav1.ConditionFalse, reason)
+}
+
 type conditionMatcher struct {
 	conditionType string
 	status        metav1.ConditionStatus
+	reason        string
 }
 
 func (matcher *conditionMatcher) Match(actual any) (bool, error) {
@@ -63,11 +78,15 @@ func (matcher *conditionMatcher) Match(actual any) (bool, error) {
 		return false, nil
 	}
 
-	if matcher.status == "" {
-		return true, nil
+	if matcher.status != "" && found.Status != matcher.status {
+		return false, nil
+	}
+
+	if matcher.reason != "" && found.Reason != matcher.reason {
+		return false, nil
 	}
 
-	return found.Status == matcher.status, nil
+	return true, nil
 }
 
 func (matcher *conditionMatcher) FailureMessage(actual any) string {
@@ -82,15 +101,24 @@ func (matcher *conditionMatcher) buildErrorMessage(actual any, negated bool) str
 	b := strings.Builder{}
 	b.WriteString("Expected\n")
 	b.WriteString(format.Object(actual, 1))
-	b.WriteString("\n")
+	b.WriteByte('\n')
 	if negated {
 		b.WriteString("not ")
 	}
 	b.WriteString("to have condition type ")
 	b.WriteString(matcher.conditionType)
 	if matcher.status != "" {
-		b.WriteString(" and status ")
+		if matcher.reason == "" {
+			b.WriteString(" and")
+		} else {
+			b.WriteByte(',')
+		}
+		b.WriteString(" status ")
 		b.WriteString(string(matcher.status))
 	}
+	if matcher.reason != "" {
+		b.WriteString(" and reason ")
+		b.WriteString(matcher.reason)
+	}
 	return b.String()
 }
diff --git a/pkg/util/testing/condition_matchers_test.go b/pkg/util/testing/condition_matchers_test.go
new file mode 100644
index 000000000..6bf5632bb
--- /dev/null
+++ b/pkg/util/testing/condition_matchers_test.go
@@ -0,0 +1,141 @@
+/*
+Copyright The Kubernetes Authors.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package testing
+
+import (
+	"testing"
+
+	"github.com/google/go-cmp/cmp"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+)
+
+func TestHaveConditionStatusAndReason(t *testing.T) {
+	testCases := map[string]struct {
+		conditionType         string
+		status                metav1.ConditionStatus
+		reason                string
+		conditions            any
+		want                  bool
+		wantErr               string
+		wantFailureMsg        string
+		wantNegatedFailureMsg string
+	}{
+		"invalid conditions": {
+			conditionType: "TestCondition",
+			conditions:    "invalid type",
+			want:          false,
+			wantErr:       "Condition matcher expects a []metav1.Condition. Got:\n    <string>: invalid type",
+		},
+		"success": {
+			conditionType: "TestCondition",
+			conditions:    []metav1.Condition{{Type: "TestCondition"}},
+			want:          true,
+		},
+		"success with status": {
+			conditionType: "TestCondition",
+			conditions:    []metav1.Condition{{Type: "TestCondition", Status: metav1.ConditionTrue}},
+			status:        metav1.ConditionTrue,
+			want:          true,
+		},
+		"success with status and reason": {
+			conditionType: "TestCondition",
+			conditions:    []metav1.Condition{{Type: "TestCondition", Status: metav1.ConditionTrue, Reason: "TestReason"}},
+			status:        metav1.ConditionTrue,
+			reason:        "TestReason",
+			want:          true,
+		},
+		"failure": {
+			conditionType: "InvalidTestCondition",
+			conditions:    []metav1.Condition{},
+			want:          false,
+			wantFailureMsg: `Expected
+    <[]v1.Condition | len:0, cap:0>: []
+to have condition type InvalidTestCondition`,
+			wantNegatedFailureMsg: `Expected
+    <[]v1.Condition | len:0, cap:0>: []
+not to have condition type InvalidTestCondition`,
+		},
+		"failure with status": {
+			conditionType: "InvalidTestCondition",
+			status:        metav1.ConditionTrue,
+			conditions:    []metav1.Condition{},
+			want:          false,
+			wantFailureMsg: `Expected
+    <[]v1.Condition | len:0, cap:0>: []
+to have condition type InvalidTestCondition and status True`,
+			wantNegatedFailureMsg: `Expected
+    <[]v1.Condition | len:0, cap:0>: []
+not to have condition type InvalidTestCondition and status True`,
+		},
+		"failure with reason": {
+			conditionType: "InvalidTestCondition",
+			reason:        "TestReason",
+			conditions:    []metav1.Condition{},
+			want:          false,
+			wantFailureMsg: `Expected
+    <[]v1.Condition | len:0, cap:0>: []
+to have condition type InvalidTestCondition and reason TestReason`,
+			wantNegatedFailureMsg: `Expected
+    <[]v1.Condition | len:0, cap:0>: []
+not to have condition type InvalidTestCondition and reason TestReason`,
+		},
+		"failure with status and reason": {
+			conditionType: "InvalidTestCondition",
+			status:        metav1.ConditionTrue,
+			reason:        "TestReason",
+			conditions:    []metav1.Condition{},
+			want:          false,
+			wantFailureMsg: `Expected
+    <[]v1.Condition | len:0, cap:0>: []
+to have condition type InvalidTestCondition, status True and reason TestReason`,
+			wantNegatedFailureMsg: `Expected
+    <[]v1.Condition | len:0, cap:0>: []
+not to have condition type InvalidTestCondition, status True and reason TestReason`,
+		},
+	}
+	for name, tc := range testCases {
+		t.Run(name, func(t *testing.T) {
+			matcher := HaveConditionStatusAndReason(tc.conditionType, tc.status, tc.reason)
+			got, gotErr := matcher.Match(tc.conditions)
+
+			var gotErrStr string
+			if gotErr != nil {
+				gotErrStr = gotErr.Error()
+			}
+
+			if diff := cmp.Diff(tc.wantErr, gotErrStr); diff != "" {
+				t.Errorf("Unexpected error (-want,+got):\n%s", diff)
+			}
+
+			if diff := cmp.Diff(tc.want, got); diff != "" {
+				t.Errorf("Unexpected result (-want,+got):\n%s", diff)
+			}
+
+			if !got && gotErr == nil {
+				gotFailureMsg := matcher.FailureMessage(tc.conditions)
+				if diff := cmp.Diff(tc.wantFailureMsg, gotFailureMsg); diff != "" {
+					t.Errorf("Unexpected failure message (-want,+got):\n%s", diff)
+				}
+
+				gotNegatedFailureMsg := matcher.NegatedFailureMessage(tc.conditions)
+				if diff := cmp.Diff(tc.wantNegatedFailureMsg, gotNegatedFailureMsg); diff != "" {
+					t.Errorf("Unexpected negated failure messge (-want,+got):\n%s", diff)
+				}
+			}
+		})
+	}
+}
diff --git a/test/e2e/customconfigs/waitforpodsready_test.go b/test/e2e/customconfigs/waitforpodsready_test.go
index 2a4cac846..2364e6984 100644
--- a/test/e2e/customconfigs/waitforpodsready_test.go
+++ b/test/e2e/customconfigs/waitforpodsready_test.go
@@ -31,7 +31,6 @@ import (
 	workloadjob "sigs.k8s.io/kueue/pkg/controller/jobs/job"
 	"sigs.k8s.io/kueue/pkg/util/testing"
 	testingjob "sigs.k8s.io/kueue/pkg/util/testingjobs/job"
-	"sigs.k8s.io/kueue/pkg/workload"
 	"sigs.k8s.io/kueue/test/util"
 )
 
@@ -102,7 +101,6 @@ var _ = ginkgo.Describe("WaitForPodsReady Job Controller E2E", func() {
 			ginkgo.By("waiting for the workload to be created and verifying it is not admitted", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, wlKey, &wl)).Should(gomega.Succeed())
-
 					g.Expect(wl.Status.Admission).To(gomega.BeNil())
 				}, util.Timeout, util.Interval).Should(gomega.Succeed())
 			})
@@ -110,22 +108,8 @@ var _ = ginkgo.Describe("WaitForPodsReady Job Controller E2E", func() {
 			ginkgo.By("waiting for the workload to be evicted", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, wlKey, &wl)).Should(gomega.Succeed())
-
-					g.Expect(
-						workload.HasConditionWithTypeAndReason(&wl, &metav1.Condition{
-							Type:   kueue.WorkloadPodsReady,
-							Status: metav1.ConditionFalse,
-							Reason: kueue.WorkloadWaitForStart,
-						}),
-					).To(gomega.BeTrue())
-
-					g.Expect(
-						workload.HasConditionWithTypeAndReason(&wl, &metav1.Condition{
-							Type:   kueue.WorkloadEvicted,
-							Status: metav1.ConditionTrue,
-							Reason: kueue.WorkloadEvictedByPodsReadyTimeout,
-						}),
-					).To(gomega.BeTrue())
+					g.Expect(wl.Status.Conditions).To(testing.HaveConditionStatusFalseAndReason(kueue.WorkloadPodsReady, kueue.WorkloadWaitForStart))
+					g.Expect(wl.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason(kueue.WorkloadEvicted, kueue.WorkloadEvictedByPodsReadyTimeout))
 				}, util.Timeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -203,20 +187,10 @@ var _ = ginkgo.Describe("WaitForPodsReady Job Controller E2E", func() {
 			ginkgo.By("verifying that the workload is requeued", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, wlKey, &wl)).Should(gomega.Succeed())
-
 					g.Expect(wl.Status.RequeueState).ShouldNot(gomega.BeNil())
 					g.Expect(*wl.Status.RequeueState.Count).To(gomega.Equal(int32(1)))
-
-					g.Expect(
-						workload.HasConditionWithTypeAndReason(&wl, &metav1.Condition{
-							Type:   kueue.WorkloadPodsReady,
-							Status: metav1.ConditionTrue,
-							Reason: kueue.WorkloadStarted,
-						}),
-					).To(gomega.BeTrue())
-
+					g.Expect(wl.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason(kueue.WorkloadPodsReady, kueue.WorkloadStarted))
 					g.Expect(wl.Status.Conditions).To(testing.HaveConditionStatusFalse(kueue.WorkloadEvicted))
-
 					g.Expect(wl.Status.Conditions).To(testing.HaveConditionStatusTrue(kueue.WorkloadRequeued))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
@@ -273,13 +247,7 @@ var _ = ginkgo.Describe("WaitForPodsReady Job Controller E2E", func() {
 			ginkgo.By("verifying the pod is recovered before recoveryTimeout", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, wlKey, &wl)).Should(gomega.Succeed())
-					g.Expect(
-						workload.HasConditionWithTypeAndReason(&wl, &metav1.Condition{
-							Type:   kueue.WorkloadPodsReady,
-							Status: metav1.ConditionTrue,
-							Reason: kueue.WorkloadRecovered,
-						}),
-					).To(gomega.BeTrue())
+					g.Expect(wl.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason(kueue.WorkloadPodsReady, kueue.WorkloadRecovered))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 		})
diff --git a/test/e2e/multikueue/e2e_test.go b/test/e2e/multikueue/e2e_test.go
index 67a6d6aa5..ac85003a8 100644
--- a/test/e2e/multikueue/e2e_test.go
+++ b/test/e2e/multikueue/e2e_test.go
@@ -495,11 +495,7 @@ var _ = ginkgo.Describe("MultiKueue", func() {
 			ginkgo.By("Waiting for the job to finish", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sManagerClient.Get(ctx, wlLookupKey, createdLeaderWorkload)).To(gomega.Succeed())
-					g.Expect(apimeta.FindStatusCondition(createdLeaderWorkload.Status.Conditions, kueue.WorkloadFinished)).To(gomega.BeComparableTo(&metav1.Condition{
-						Type:   kueue.WorkloadFinished,
-						Status: metav1.ConditionTrue,
-						Reason: kueue.WorkloadFinishedReasonSucceeded,
-					}, util.IgnoreConditionMessage, util.IgnoreConditionTimestampsAndObservedGeneration))
+					g.Expect(createdLeaderWorkload.Status.Conditions).To(utiltesting.HaveConditionStatusTrueAndReason(kueue.WorkloadFinished, kueue.WorkloadFinishedReasonSucceeded))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -925,13 +921,7 @@ var _ = ginkgo.Describe("MultiKueue", func() {
 				readClient := &kueue.MultiKueueCluster{}
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sManagerClient.Get(ctx, worker1ClusterKey, readClient)).To(gomega.Succeed())
-					g.Expect(readClient.Status.Conditions).To(gomega.ContainElement(gomega.BeComparableTo(
-						metav1.Condition{
-							Type:   kueue.MultiKueueClusterActive,
-							Status: metav1.ConditionFalse,
-							Reason: "ClientConnectionFailed",
-						},
-						util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage)))
+					g.Expect(readClient.Status.Conditions).To(utiltesting.HaveConditionStatusFalseAndReason(kueue.MultiKueueClusterActive, "ClientConnectionFailed"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
diff --git a/test/e2e/singlecluster/e2e_test.go b/test/e2e/singlecluster/e2e_test.go
index 5a89f7c2a..4f41c5c42 100644
--- a/test/e2e/singlecluster/e2e_test.go
+++ b/test/e2e/singlecluster/e2e_test.go
@@ -195,12 +195,7 @@ var _ = ginkgo.Describe("Kueue", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(wl), createdWorkload)).To(gomega.Succeed())
 					g.Expect(createdWorkload.Finalizers).NotTo(gomega.ContainElement(kueue.ResourceInUseFinalizerName))
-					g.Expect(createdWorkload.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:   kueue.WorkloadFinished,
-							Status: metav1.ConditionTrue,
-							Reason: kueue.WorkloadFinishedReasonFailed,
-						}, util.IgnoreConditionMessage, util.IgnoreConditionTimestampsAndObservedGeneration)))
+					g.Expect(createdWorkload.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason(kueue.WorkloadFinished, kueue.WorkloadFinishedReasonFailed))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 		})
diff --git a/test/e2e/singlecluster/jobset_test.go b/test/e2e/singlecluster/jobset_test.go
index 4d29bb808..a61e6e2fc 100644
--- a/test/e2e/singlecluster/jobset_test.go
+++ b/test/e2e/singlecluster/jobset_test.go
@@ -20,12 +20,9 @@ import (
 	"github.com/onsi/ginkgo/v2"
 	"github.com/onsi/gomega"
 	corev1 "k8s.io/api/core/v1"
-	apimeta "k8s.io/apimachinery/pkg/api/meta"
-	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/types"
 	"k8s.io/utils/ptr"
 	"sigs.k8s.io/controller-runtime/pkg/client"
-	"sigs.k8s.io/jobset/pkg/constants"
 
 	kueue "sigs.k8s.io/kueue/apis/kueue/v1beta1"
 	workloadjobset "sigs.k8s.io/kueue/pkg/controller/jobs/jobset"
@@ -99,12 +96,7 @@ var _ = ginkgo.Describe("JobSet", func() {
 			ginkgo.By("Waiting for the jobSet to finish", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, wlLookupKey, createdLeaderWorkload)).To(gomega.Succeed())
-					g.Expect(apimeta.FindStatusCondition(createdLeaderWorkload.Status.Conditions, kueue.WorkloadFinished)).To(gomega.BeComparableTo(&metav1.Condition{
-						Type:    kueue.WorkloadFinished,
-						Status:  metav1.ConditionTrue,
-						Reason:  kueue.WorkloadFinishedReasonSucceeded,
-						Message: constants.AllJobsCompletedMessage,
-					}, util.IgnoreConditionTimestampsAndObservedGeneration))
+					g.Expect(createdLeaderWorkload.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason(kueue.WorkloadFinished, kueue.WorkloadFinishedReasonSucceeded))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 		})
diff --git a/test/e2e/singlecluster/leaderworkerset_test.go b/test/e2e/singlecluster/leaderworkerset_test.go
index 866fe2d7d..d441ba0ff 100644
--- a/test/e2e/singlecluster/leaderworkerset_test.go
+++ b/test/e2e/singlecluster/leaderworkerset_test.go
@@ -21,7 +21,6 @@ import (
 	"github.com/onsi/gomega"
 	corev1 "k8s.io/api/core/v1"
 	"k8s.io/apimachinery/pkg/api/resource"
-	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 	"k8s.io/apimachinery/pkg/types"
 	"k8s.io/utils/ptr"
 	"sigs.k8s.io/controller-runtime/pkg/client"
@@ -100,14 +99,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:    "Available",
-							Status:  metav1.ConditionTrue,
-							Reason:  "AllGroupsReady",
-							Message: "All replicas are ready",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -158,14 +150,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:    "Available",
-							Status:  metav1.ConditionTrue,
-							Reason:  "AllGroupsReady",
-							Message: "All replicas are ready",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -214,14 +199,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(2)))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:    "Available",
-							Status:  metav1.ConditionTrue,
-							Reason:  "AllGroupsReady",
-							Message: "All replicas are ready",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -279,14 +257,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 					gomega.Eventually(func(g gomega.Gomega) {
 						g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 						g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-							gomega.BeComparableTo(metav1.Condition{
-								Type:    "Available",
-								Status:  metav1.ConditionTrue,
-								Reason:  "AllGroupsReady",
-								Message: "All replicas are ready",
-							}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-						)
+						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 					}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 				})
 
@@ -308,14 +279,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 					gomega.Eventually(func(g gomega.Gomega) {
 						g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 						g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(2)))
-						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-							gomega.BeComparableTo(metav1.Condition{
-								Type:    "Available",
-								Status:  metav1.ConditionTrue,
-								Reason:  "AllGroupsReady",
-								Message: "All replicas are ready",
-							}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-						)
+						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 					}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 				})
 
@@ -374,14 +338,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 					gomega.Eventually(func(g gomega.Gomega) {
 						g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 						g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(2)))
-						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-							gomega.BeComparableTo(metav1.Condition{
-								Type:    "Available",
-								Status:  metav1.ConditionTrue,
-								Reason:  "AllGroupsReady",
-								Message: "All replicas are ready",
-							}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-						)
+						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 					}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 				})
 
@@ -409,14 +366,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 					gomega.Eventually(func(g gomega.Gomega) {
 						g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 						g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-							gomega.BeComparableTo(metav1.Condition{
-								Type:    "Available",
-								Status:  metav1.ConditionTrue,
-								Reason:  "AllGroupsReady",
-								Message: "All replicas are ready",
-							}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-						)
+						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 					}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 				})
 
@@ -472,13 +422,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 					gomega.Eventually(func(g gomega.Gomega) {
 						g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 						g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-							gomega.BeComparableTo(metav1.Condition{
-								Type:   "Available",
-								Status: metav1.ConditionTrue,
-								Reason: "AllGroupsReady",
-							}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage)),
-						)
+						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 					}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 				})
 
@@ -508,13 +452,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 					gomega.Eventually(func(g gomega.Gomega) {
 						g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 						g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-							gomega.BeComparableTo(metav1.Condition{
-								Type:   "Available",
-								Status: metav1.ConditionTrue,
-								Reason: "AllGroupsReady",
-							}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage)),
-						)
+						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 					}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 				})
 
@@ -593,14 +531,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 					gomega.Eventually(func(g gomega.Gomega) {
 						g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 						g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(2)))
-						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-							gomega.BeComparableTo(metav1.Condition{
-								Type:    "Available",
-								Status:  metav1.ConditionTrue,
-								Reason:  "AllGroupsReady",
-								Message: "All replicas are ready",
-							}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-						)
+						g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 					}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 				})
 
@@ -676,14 +607,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(2)))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:    "Available",
-							Status:  metav1.ConditionTrue,
-							Reason:  "AllGroupsReady",
-							Message: "All replicas are ready",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -716,14 +640,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 					createdLeaderWorkerSet := &leaderworkersetv1.LeaderWorkerSet{}
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(2)))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:    "Available",
-							Status:  metav1.ConditionTrue,
-							Reason:  "AllGroupsReady",
-							Message: "All replicas are ready",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -808,13 +725,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lowPriorityLWS), createdLowPriorityLWS)).To(gomega.Succeed())
 					g.Expect(createdLowPriorityLWS.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-					g.Expect(createdLowPriorityLWS.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:   "Available",
-							Status: metav1.ConditionTrue,
-							Reason: "AllGroupsReady",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage),
-					))
+					g.Expect(createdLowPriorityLWS.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -850,13 +761,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(highPriorityLWS), createdHighPriorityLWS)).To(gomega.Succeed())
 					g.Expect(createdHighPriorityLWS.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-					g.Expect(createdHighPriorityLWS.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:   "Available",
-							Status: metav1.ConditionTrue,
-							Reason: "AllGroupsReady",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage),
-					))
+					g.Expect(createdHighPriorityLWS.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -865,18 +770,8 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lowPriorityLWS), createdLowPriorityLWS)).To(gomega.Succeed())
 					g.Expect(createdLowPriorityLWS.Status.ReadyReplicas).To(gomega.Equal(int32(0)))
-					g.Expect(createdLowPriorityLWS.Status.Conditions).To(gomega.ContainElements(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:   "Progressing",
-							Status: metav1.ConditionTrue,
-							Reason: "GroupsProgressing",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage),
-						gomega.BeComparableTo(metav1.Condition{
-							Type:   "Available",
-							Status: metav1.ConditionFalse,
-							Reason: "AllGroupsReady",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage),
-					))
+					g.Expect(createdLowPriorityLWS.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Progressing", "GroupsProgressing"))
+					g.Expect(createdLowPriorityLWS.Status.Conditions).To(testing.HaveConditionStatusFalseAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -925,13 +820,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:   "Available",
-							Status: metav1.ConditionTrue,
-							Reason: "AllGroupsReady",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -960,13 +849,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(0)))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:   "Available",
-							Status: metav1.ConditionFalse,
-							Reason: "AllGroupsReady",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusFalseAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
@@ -1007,13 +890,7 @@ var _ = ginkgo.Describe("LeaderWorkerSet integration", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(int32(1)))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:   "Available",
-							Status: metav1.ConditionTrue,
-							Reason: "AllGroupsReady",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration, util.IgnoreConditionMessage)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
diff --git a/test/e2e/singlecluster/metrics_test.go b/test/e2e/singlecluster/metrics_test.go
index 4e8e6f2b0..1fb1a0150 100644
--- a/test/e2e/singlecluster/metrics_test.go
+++ b/test/e2e/singlecluster/metrics_test.go
@@ -282,8 +282,7 @@ var _ = ginkgo.Describe("Metrics", func() {
 
 			gomega.Eventually(func(g gomega.Gomega) {
 				g.Expect(k8sClient.Get(ctx, workloadKey, createdWorkload)).Should(gomega.Succeed())
-				g.Expect(createdWorkload.Status.Conditions).
-					Should(utiltesting.HaveConditionStatusTrue(v1beta1.WorkloadQuotaReserved))
+				g.Expect(createdWorkload.Status.Conditions).Should(utiltesting.HaveConditionStatusTrue(v1beta1.WorkloadQuotaReserved))
 			}, util.Timeout, util.Interval).Should(gomega.Succeed())
 		})
 
@@ -510,17 +509,7 @@ var _ = ginkgo.Describe("Metrics", func() {
 
 			gomega.Eventually(func(g gomega.Gomega) {
 				g.Expect(k8sClient.Get(ctx, blockerWorkloadKey, blockerWorkload)).To(gomega.Succeed())
-
-				g.Expect(blockerWorkload.Status.Conditions).To(
-					gomega.ContainElements(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:    v1beta1.WorkloadEvicted,
-							Status:  metav1.ConditionTrue,
-							Reason:  "Deactivated",
-							Message: "The workload is deactivated",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration),
-					),
-				)
+				g.Expect(blockerWorkload.Status.Conditions).To(utiltesting.HaveConditionStatusTrueAndReason(v1beta1.WorkloadEvicted, v1beta1.WorkloadDeactivated))
 			}, util.Timeout, util.Interval).Should(gomega.Succeed())
 
 			ginkgo.By("Expecting at least one of the high-priority jobs to be admitted", func() {
diff --git a/test/e2e/tas/leaderworkerset_test.go b/test/e2e/tas/leaderworkerset_test.go
index a9db74351..92740dd42 100644
--- a/test/e2e/tas/leaderworkerset_test.go
+++ b/test/e2e/tas/leaderworkerset_test.go
@@ -124,14 +124,7 @@ var _ = ginkgo.Describe("TopologyAwareScheduling for LeaderWorkerSet", func() {
 				gomega.Eventually(func(g gomega.Gomega) {
 					g.Expect(k8sClient.Get(ctx, client.ObjectKeyFromObject(lws), createdLeaderWorkerSet)).To(gomega.Succeed())
 					g.Expect(createdLeaderWorkerSet.Status.ReadyReplicas).To(gomega.Equal(replicas))
-					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(gomega.ContainElement(
-						gomega.BeComparableTo(metav1.Condition{
-							Type:    "Available",
-							Status:  metav1.ConditionTrue,
-							Reason:  "AllGroupsReady",
-							Message: "All replicas are ready",
-						}, util.IgnoreConditionTimestampsAndObservedGeneration)),
-					)
+					g.Expect(createdLeaderWorkerSet.Status.Conditions).To(testing.HaveConditionStatusTrueAndReason("Available", "AllGroupsReady"))
 				}, util.LongTimeout, util.Interval).Should(gomega.Succeed())
 			})
 
diff --git a/test/integration/singlecluster/controller/core/clusterqueue_controller_test.go b/test/integration/singlecluster/controller/core/clusterqueue_controller_test.go
index 6baf9a886..c7aa1ad54 100644
--- a/test/integration/singlecluster/controller/core/clusterqueue_controller_test.go
+++ b/test/integration/singlecluster/controller/core/clusterqueue_controller_test.go
@@ -195,7 +195,7 @@ var _ = ginkgo.Describe("ClusterQueue controller", ginkgo.Ordered, ginkgo.Contin
 							Type:    kueue.ClusterQueueActive,
 							Status:  metav1.ConditionFalse,
 							Reason:  "FlavorNotFound",
-							Message: "Can't admit new workloads: references missing ResourceFlavor(s): [on-demand spot model-a model-b].",
+							Message: "Can't admit new workloads: references missing ResourceFlavor(s): on-demand,spot,model-a,model-b.",
 						},
 					},
 				}, util.IgnoreConditionTimestampsAndObservedGeneration, ignorePendingWorkloadsStatus))
@@ -385,7 +385,7 @@ var _ = ginkgo.Describe("ClusterQueue controller", ginkgo.Ordered, ginkgo.Contin
 							Type:    kueue.ClusterQueueActive,
 							Status:  metav1.ConditionFalse,
 							Reason:  "FlavorNotFound",
-							Message: "Can't admit new workloads: references missing ResourceFlavor(s): [on-demand spot model-a model-b].",
+							Message: "Can't admit new workloads: references missing ResourceFlavor(s): on-demand,spot,model-a,model-b.",
 						},
 					},
 				}, util.IgnoreConditionTimestampsAndObservedGeneration, ignorePendingWorkloadsStatus))
@@ -413,7 +413,7 @@ var _ = ginkgo.Describe("ClusterQueue controller", ginkgo.Ordered, ginkgo.Contin
 							Type:    kueue.ClusterQueueActive,
 							Status:  metav1.ConditionFalse,
 							Reason:  "FlavorNotFound",
-							Message: "Can't admit new workloads: references missing ResourceFlavor(s): [on-demand spot model-a model-b].",
+							Message: "Can't admit new workloads: references missing ResourceFlavor(s): on-demand,spot,model-a,model-b.",
 						},
 					},
 				}, util.IgnoreConditionTimestampsAndObservedGeneration, ignorePendingWorkloadsStatus))
@@ -663,7 +663,7 @@ var _ = ginkgo.Describe("ClusterQueue controller", ginkgo.Ordered, ginkgo.Contin
 						Type:    kueue.ClusterQueueActive,
 						Status:  metav1.ConditionFalse,
 						Reason:  "FlavorNotFound",
-						Message: "Can't admit new workloads: references missing ResourceFlavor(s): [arch-a arch-b].",
+						Message: "Can't admit new workloads: references missing ResourceFlavor(s): arch-a,arch-b.",
 					},
 				}, util.IgnoreConditionTimestampsAndObservedGeneration))
 			}, util.Timeout, util.Interval).Should(gomega.Succeed())
@@ -679,7 +679,7 @@ var _ = ginkgo.Describe("ClusterQueue controller", ginkgo.Ordered, ginkgo.Contin
 						Type:    kueue.ClusterQueueActive,
 						Status:  metav1.ConditionFalse,
 						Reason:  "FlavorNotFound",
-						Message: "Can't admit new workloads: references missing ResourceFlavor(s): [arch-b].",
+						Message: "Can't admit new workloads: references missing ResourceFlavor(s): arch-b.",
 					},
 				}, util.IgnoreConditionTimestampsAndObservedGeneration))
 			}, util.Timeout, util.Interval).Should(gomega.Succeed())
@@ -718,7 +718,7 @@ var _ = ginkgo.Describe("ClusterQueue controller", ginkgo.Ordered, ginkgo.Contin
 						Type:    kueue.ClusterQueueActive,
 						Status:  metav1.ConditionFalse,
 						Reason:  "AdmissionCheckNotFound",
-						Message: "Can't admit new workloads: references missing AdmissionCheck(s): [check1 check2].",
+						Message: "Can't admit new workloads: references missing AdmissionCheck(s): check1,check2.",
 					},
 				}, util.IgnoreConditionTimestampsAndObservedGeneration))
 			}, util.Timeout, util.Interval).Should(gomega.Succeed())
@@ -735,7 +735,7 @@ var _ = ginkgo.Describe("ClusterQueue controller", ginkgo.Ordered, ginkgo.Contin
 						Type:    kueue.ClusterQueueActive,
 						Status:  metav1.ConditionFalse,
 						Reason:  "AdmissionCheckNotFound",
-						Message: "Can't admit new workloads: references missing AdmissionCheck(s): [check2].",
+						Message: "Can't admit new workloads: references missing AdmissionCheck(s): check2.",
 					},
 				}, util.IgnoreConditionTimestampsAndObservedGeneration))
 			}, util.Timeout, util.Interval).Should(gomega.Succeed())
@@ -751,7 +751,7 @@ var _ = ginkgo.Describe("ClusterQueue controller", ginkgo.Ordered, ginkgo.Contin
 						Type:    kueue.ClusterQueueActive,
 						Status:  metav1.ConditionFalse,
 						Reason:  "AdmissionCheckInactive",
-						Message: "Can't admit new workloads: references inactive AdmissionCheck(s): [check2].",
+						Message: "Can't admit new workloads: references inactive AdmissionCheck(s): check2.",
 					},
 				}, util.IgnoreConditionTimestampsAndObservedGeneration))
 			}, util.Timeout, util.Interval).Should(gomega.Succeed())
diff --git a/test/integration/singlecluster/tas/tas_test.go b/test/integration/singlecluster/tas/tas_test.go
index de8b29fc0..98943ce81 100644
--- a/test/integration/singlecluster/tas/tas_test.go
+++ b/test/integration/singlecluster/tas/tas_test.go
@@ -636,7 +636,7 @@ var _ = ginkgo.Describe("Topology Aware Scheduling", ginkgo.Ordered, func() {
 								Type:    kueue.ClusterQueueActive,
 								Status:  metav1.ConditionFalse,
 								Reason:  "FlavorNotFound",
-								Message: `Can't admit new workloads: references missing ResourceFlavor(s): [tas-flavor].`,
+								Message: `Can't admit new workloads: references missing ResourceFlavor(s): tas-flavor.`,
 							},
 						}, util.IgnoreConditionTimestampsAndObservedGeneration))
 					}, util.Timeout, util.Interval).Should(gomega.Succeed())