Skip to content

Commit b807b51

Browse files
Merge pull request #29799 from openshift-cherrypick-robot/cherry-pick-29723-to-release-4.19
OCPBUGS-56399: fix watch request counts
2 parents 65422c8 + 0aa6dd0 commit b807b51

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

pkg/monitortests/kubeapiserver/auditloganalyzer/handle_operator_watch_count_tracking.go

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ func (s *watchCountTracking) CreateJunits() ([]*junitapi.JUnitTestCase, error) {
141141
ret := []*junitapi.JUnitTestCase{}
142142

143143
testName := "[sig-arch][Late] operators should not create watch channels very often"
144+
testMinRequestsName := "[sig-arch][Late] operators should have watch channel requests"
144145
oc := exutil.NewCLIWithoutNamespace("operator-watch")
145146
infra, err := oc.AdminConfigClient().ConfigV1().Infrastructures().Get(context.Background(), "cluster", metav1.GetOptions{})
146147
if err != nil {
@@ -153,6 +154,15 @@ func (s *watchCountTracking) CreateJunits() ([]*junitapi.JUnitTestCase, error) {
153154
},
154155
)
155156

157+
ret = append(ret, &junitapi.JUnitTestCase{
158+
Name: testMinRequestsName,
159+
FailureOutput: &junitapi.FailureOutput{
160+
Message: err.Error(),
161+
Output: err.Error(),
162+
},
163+
},
164+
)
165+
156166
return ret, nil
157167
}
158168

@@ -376,27 +386,69 @@ func (s *watchCountTracking) CreateJunits() ([]*junitapi.JUnitTestCase, error) {
376386
}
377387

378388
var upperBound platformUpperBound
379-
if infra.Status.ControlPlaneTopology == configv1.SingleReplicaTopologyMode {
389+
390+
switch infra.Status.ControlPlaneTopology {
391+
case configv1.ExternalTopologyMode:
392+
return []*junitapi.JUnitTestCase{{
393+
Name: testName,
394+
SkipMessage: &junitapi.SkipMessage{Message: fmt.Sprintf("unsupported topology: %v", infra.Status.ControlPlaneTopology)},
395+
}, {
396+
Name: testMinRequestsName,
397+
SkipMessage: &junitapi.SkipMessage{Message: fmt.Sprintf("unsupported topology: %v", infra.Status.ControlPlaneTopology)},
398+
}}, nil
399+
400+
case configv1.SingleReplicaTopologyMode:
380401
if _, exists := upperBoundsSingleNode[infra.Spec.PlatformSpec.Type]; !exists {
381402
return []*junitapi.JUnitTestCase{{
382403
Name: testName,
383404
SkipMessage: &junitapi.SkipMessage{Message: fmt.Sprintf("unsupported single node platform type: %v", infra.Spec.PlatformSpec.Type)},
405+
}, {
406+
Name: testMinRequestsName,
407+
SkipMessage: &junitapi.SkipMessage{Message: fmt.Sprintf("unsupported single node platform type: %v", infra.Spec.PlatformSpec.Type)},
384408
}}, nil
385409

386410
}
387411
upperBound = upperBoundsSingleNode[infra.Spec.PlatformSpec.Type]
388-
} else {
412+
413+
default:
389414
if _, exists := upperBounds[infra.Spec.PlatformSpec.Type]; !exists {
390415
return []*junitapi.JUnitTestCase{{
391416
Name: testName,
392417
SkipMessage: &junitapi.SkipMessage{Message: fmt.Sprintf("unsupported platform type: %v", infra.Spec.PlatformSpec.Type)},
418+
}, {
419+
Name: testMinRequestsName,
420+
SkipMessage: &junitapi.SkipMessage{Message: fmt.Sprintf("unsupported platform type: %v", infra.Spec.PlatformSpec.Type)},
393421
}}, nil
394422
}
395423
upperBound = upperBounds[infra.Spec.PlatformSpec.Type]
396424
}
397425

398426
watchRequestCounts := s.SummarizeWatchCountRequests()
399427

428+
if len(watchRequestCounts) == 0 {
429+
ret = append(ret,
430+
&junitapi.JUnitTestCase{
431+
Name: testMinRequestsName,
432+
FailureOutput: &junitapi.FailureOutput{
433+
Message: "Expected at least one watch request count to be present",
434+
},
435+
},
436+
)
437+
// flake for now
438+
ret = append(ret,
439+
&junitapi.JUnitTestCase{
440+
Name: testMinRequestsName,
441+
},
442+
)
443+
444+
} else {
445+
ret = append(ret,
446+
&junitapi.JUnitTestCase{
447+
Name: testMinRequestsName,
448+
},
449+
)
450+
}
451+
400452
operatorBoundExceeded := []string{}
401453
for _, item := range watchRequestCounts {
402454
operator := strings.Split(item.Operator, ":")[3]

0 commit comments

Comments
 (0)