Skip to content

Commit a631c60

Browse files
Merge pull request #30685 from ehearne-redhat/fail-uncaught-default-sa-usage
CNTRLPLANE-2202: add new exceptions + fail if uncaught default sa usage is detected
2 parents b2dacba + 2776831 commit a631c60

1 file changed

Lines changed: 27 additions & 21 deletions

File tree

  • pkg/monitortests/authentication/nodefaultserviceaccountoperatortests

pkg/monitortests/authentication/nodefaultserviceaccountoperatortests/monitortest.go

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,27 @@ var exceptions = []func(pod corev1.Pod) (string, bool){
7575
}
7676
return "", false
7777
},
78+
79+
// These exceptions were found after the monitor test was merged.
80+
exceptionWithJira("openshift-cnv/kubevirt-apiserver-proxy-", "https://issues.redhat.com/browse/OCPBUGS-70353"),
81+
exceptionWithJira("openshift-cnv/kubevirt-console-plugin-", "https://issues.redhat.com/browse/OCPBUGS-70353"),
82+
exceptionWithJira("kube-system/global-pull-secret-syncer-", "https://issues.redhat.com/browse/OCPBUGS-70354"),
83+
84+
// Handle the outlier (Namespace only check) manually
85+
func(pod corev1.Pod) (string, bool) {
86+
if pod.Namespace == "openshift-cluster-csi-drivers" {
87+
return "https://issues.redhat.com/browse/OCPBUGS-70355", true
88+
}
89+
return "", false
90+
},
91+
// Handle the outlier (Namespace only check) manually
92+
// This one might be simplified to check if it is a debug pod or not.
93+
func(pod corev1.Pod) (string, bool) {
94+
if pod.Namespace == "openshift-commatrix-test" && strings.Contains(pod.Name, "debug") {
95+
return "https://issues.redhat.com/browse/OCPBUGS-77201", true
96+
}
97+
return "", false
98+
},
7899
}
79100

80101
// generateTestCases evaluates that no pods in the provided namespace are using the default service account.
@@ -128,28 +149,13 @@ func (n *noDefaultServiceAccountChecker) generateTestCases(ctx context.Context,
128149
FailureOutput: &junitapi.FailureOutput{Output: aggregatedListMsg},
129150
})
130151

131-
/// TODO(ehearne-redhat): restore this conditional behavior to
132-
// only flake when there are only exceptions found once we are
133-
// confident we have properly captured all exception cases.
134-
// ------------------------------------------------
135152
// if there are only exceptions we can add a flake
136-
/*
137-
if len(failureList) == 0 && len(exceptionList) != 0 {
138-
// introduce flake
139-
junits = append(junits, &junitapi.JUnitTestCase{
140-
Name: testName,
141-
})
142-
}
143-
*/
144-
145-
// ------------------------------------------------
146-
// TODO(ehearne-redhat): Remove this always flake logic
147-
// once we are confident we have properly captured all exception cases.
148-
// ------------------------------------------------
149-
junits = append(junits, &junitapi.JUnitTestCase{
150-
Name: testName,
151-
})
152-
// ------------------------------------------------
153+
if len(failureList) == 0 && len(exceptionList) != 0 {
154+
// introduce flake
155+
junits = append(junits, &junitapi.JUnitTestCase{
156+
Name: testName,
157+
})
158+
}
153159

154160
return junits, nil
155161
}

0 commit comments

Comments
 (0)