Skip to content

Commit 200b60d

Browse files
committed
NO-JIRA: handle inconsistent ns like openshift-infra
1 parent 8bed5b3 commit 200b60d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

pkg/monitortestlibrary/platformidentification/operator_mapping.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ func init() {
231231
utilruntime.Must(addNamespaceMapping("openshift-service-ca-operator", "service-ca"))
232232
utilruntime.Must(addNamespaceMapping("openshift-user-workload-monitoring", "Unknown"))
233233
utilruntime.Must(addNamespaceMapping("openshift-vsphere-infra", "Unknown"))
234+
utilruntime.Must(addNamespaceMapping("openshift-infra", "Unknown"))
234235

235236
KnownNamespaces = sets.StringKeySet(namespaceToBugzillaComponent)
236237
}

pkg/monitortests/clusterversionoperator/terminationmessagepolicy/monitortest.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
configclient "github.com/openshift/client-go/config/clientset/versioned"
1010
"github.com/openshift/origin/pkg/monitor/monitorapi"
1111
"github.com/openshift/origin/pkg/monitortestframework"
12+
"github.com/openshift/origin/pkg/monitortestlibrary/platformidentification"
1213
"github.com/openshift/origin/pkg/test/ginkgo/junitapi"
1314
corev1 "k8s.io/api/core/v1"
1415
apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -89,12 +90,6 @@ func (w *terminationMessagePolicyChecker) CollectData(ctx context.Context, stora
8990
if strings.HasPrefix(pod.Namespace, "openshift-must-gather") {
9091
continue
9192
}
92-
// namespace does not show up consistently so we get
93-
// 1 pass or flake out of 10 runs and fail due to not
94-
// enough passes
95-
if strings.HasPrefix(pod.Namespace, "openshift-infra") {
96-
continue
97-
}
9893

9994
if _, ok := failuresByNamespace[pod.Namespace]; !ok {
10095
failuresByNamespace[pod.Namespace] = []string{}
@@ -138,8 +133,10 @@ func (w *terminationMessagePolicyChecker) CollectData(ctx context.Context, stora
138133
),
139134
}
140135

136+
observedNamespace := map[string]bool{}
141137
junits := []*junitapi.JUnitTestCase{}
142138
for _, namespace := range sets.StringKeySet(failuresByNamespace).List() {
139+
observedNamespace[namespace] = true
143140
testName := fmt.Sprintf("[sig-arch] all containers in ns/%v must have terminationMessagePolicy=%v", namespace, corev1.TerminationMessageFallbackToLogsOnError)
144141
failingContainers := sets.NewString(failuresByNamespace[namespace]...)
145142
if len(failingContainers) == 0 {
@@ -214,6 +211,19 @@ func (w *terminationMessagePolicyChecker) CollectData(ctx context.Context, stora
214211

215212
}
216213

214+
knownNamespaces := platformidentification.KnownNamespaces
215+
for _, namespace := range sets.StringKeySet(knownNamespaces).List() {
216+
// if we didn't observe this namespace then create the passing test to ensure the test is always created
217+
if _, ok := observedNamespace[namespace]; !ok {
218+
testName := fmt.Sprintf("[sig-arch] all containers in ns/%v must have terminationMessagePolicy=%v", namespace, corev1.TerminationMessageFallbackToLogsOnError)
219+
junits = append(junits, &junitapi.JUnitTestCase{
220+
Name: testName,
221+
SystemOut: "",
222+
SystemErr: "",
223+
})
224+
}
225+
}
226+
217227
return nil, junits, nil
218228
}
219229

0 commit comments

Comments
 (0)