|
9 | 9 | configclient "github.com/openshift/client-go/config/clientset/versioned" |
10 | 10 | "github.com/openshift/origin/pkg/monitor/monitorapi" |
11 | 11 | "github.com/openshift/origin/pkg/monitortestframework" |
| 12 | + "github.com/openshift/origin/pkg/monitortestlibrary/platformidentification" |
12 | 13 | "github.com/openshift/origin/pkg/test/ginkgo/junitapi" |
13 | 14 | corev1 "k8s.io/api/core/v1" |
14 | 15 | apierrors "k8s.io/apimachinery/pkg/api/errors" |
@@ -89,12 +90,6 @@ func (w *terminationMessagePolicyChecker) CollectData(ctx context.Context, stora |
89 | 90 | if strings.HasPrefix(pod.Namespace, "openshift-must-gather") { |
90 | 91 | continue |
91 | 92 | } |
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 | | - } |
98 | 93 |
|
99 | 94 | if _, ok := failuresByNamespace[pod.Namespace]; !ok { |
100 | 95 | failuresByNamespace[pod.Namespace] = []string{} |
@@ -138,8 +133,10 @@ func (w *terminationMessagePolicyChecker) CollectData(ctx context.Context, stora |
138 | 133 | ), |
139 | 134 | } |
140 | 135 |
|
| 136 | + observedNamespace := map[string]bool{} |
141 | 137 | junits := []*junitapi.JUnitTestCase{} |
142 | 138 | for _, namespace := range sets.StringKeySet(failuresByNamespace).List() { |
| 139 | + observedNamespace[namespace] = true |
143 | 140 | testName := fmt.Sprintf("[sig-arch] all containers in ns/%v must have terminationMessagePolicy=%v", namespace, corev1.TerminationMessageFallbackToLogsOnError) |
144 | 141 | failingContainers := sets.NewString(failuresByNamespace[namespace]...) |
145 | 142 | if len(failingContainers) == 0 { |
@@ -214,6 +211,19 @@ func (w *terminationMessagePolicyChecker) CollectData(ctx context.Context, stora |
214 | 211 |
|
215 | 212 | } |
216 | 213 |
|
| 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 | + |
217 | 227 | return nil, junits, nil |
218 | 228 | } |
219 | 229 |
|
|
0 commit comments