Skip to content

Commit 85c81f7

Browse files
committed
removed AssertCheckResultByLabel and its call cause of dubplication
1 parent f59c22c commit 85c81f7

File tree

2 files changed

+9
-37
lines changed

2 files changed

+9
-37
lines changed

tests/e2e/framework/common.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,30 +2175,6 @@ func (f *Framework) AssertHasCheck(suiteName, scanName string, check compv1alpha
21752175

21762176
return nil
21772177
}
2178-
2179-
// AssertCheckResultByLabel verifies that a ComplianceCheckResult with the expected name exists
2180-
// when filtering by a specific label selector
2181-
func (f *Framework) AssertCheckResultByLabel(namespace, labelKey, labelValue, expectedCheckName string) error {
2182-
var checkList compv1alpha1.ComplianceCheckResultList
2183-
checkListOpts := client.MatchingLabels{
2184-
labelKey: labelValue,
2185-
}
2186-
listOpts := client.InNamespace(namespace)
2187-
2188-
if err := f.Client.List(context.TODO(), &checkList, &checkListOpts, &listOpts); err != nil {
2189-
return fmt.Errorf("failed to list ComplianceCheckResults with label %s=%s: %w", labelKey, labelValue, err)
2190-
}
2191-
2192-
// Check if the expected check name is in the list
2193-
for _, check := range checkList.Items {
2194-
if check.Name == expectedCheckName {
2195-
return nil
2196-
}
2197-
}
2198-
2199-
return fmt.Errorf("ComplianceCheckResult %s not found in list filtered by label %s=%s", expectedCheckName, labelKey, labelValue)
2200-
}
2201-
22022178
func (f *Framework) AssertHasRemediations(suiteName, scanName, roleLabel string, remNameList []string) error {
22032179
var scanSuiteMapNames = make(map[string]bool)
22042180
var scanSuiteRemediations []compv1alpha1.ComplianceRemediation

tests/e2e/parallel/main_test.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -983,21 +983,17 @@ func TestScanProducesRemediationsAndLabels(t *testing.T) {
983983
}
984984
// Use the first check to verify labels are working correctly
985985
firstCheck := checkList.Items[0]
986-
// Verify all required labels are present and can be queried
987-
labelsToVerify := map[string]string{
988-
compv1alpha1.SuiteLabel: bindingName,
989-
compv1alpha1.ComplianceScanLabel: firstCheck.Labels[compv1alpha1.ComplianceScanLabel],
990-
compv1alpha1.ComplianceCheckResultSeverityLabel: firstCheck.Labels[compv1alpha1.ComplianceCheckResultSeverityLabel],
991-
compv1alpha1.ComplianceCheckResultStatusLabel: firstCheck.Labels[compv1alpha1.ComplianceCheckResultStatusLabel],
992-
}
993-
for label, value := range labelsToVerify {
994-
if value == "" {
986+
// Verify all required labels are present
987+
labelsToVerify := []string{
988+
compv1alpha1.SuiteLabel,
989+
compv1alpha1.ComplianceScanLabel,
990+
compv1alpha1.ComplianceCheckResultSeverityLabel,
991+
compv1alpha1.ComplianceCheckResultStatusLabel,
992+
}
993+
for _, label := range labelsToVerify {
994+
if firstCheck.Labels[label] == "" {
995995
t.Fatalf("check %s is missing label %s", firstCheck.Name, label)
996996
}
997-
err = f.AssertCheckResultByLabel(f.OperatorNamespace, label, value, firstCheck.Name)
998-
if err != nil {
999-
t.Fatal(err)
1000-
}
1001997
}
1002998
}
1003999

0 commit comments

Comments
 (0)