Skip to content

Commit 757b4b3

Browse files
deads2kbertinatto
authored andcommitted
UPSTREAM: 103612: tolerate additional, but congruent, events for integration test
OpenShift-Rebase-Source: 2f4c829 UPSTREAM: 103612: tolerate additional, but congruent, events for integration test
1 parent ff603d9 commit 757b4b3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

test/integration/events/events_test.go

+14-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ func TestEventCompatibility(t *testing.T) {
7979
return false, err
8080
}
8181

82-
if len(v1Events.Items) != 2 {
82+
// Be sure that at least the events we sent in the test were delivered.
83+
// To add any events from the kube-apiserver itself will require this tolerate additional events.
84+
if len(v1Events.Items) < 2 {
8385
return false, nil
8486
}
8587

@@ -88,9 +90,15 @@ func TestEventCompatibility(t *testing.T) {
8890
return false, err
8991
}
9092

91-
if len(events.Items) != 2 {
93+
if len(events.Items) < 2 {
9294
return false, nil
9395
}
96+
97+
// Be sure that both APIs produce the same number of events.
98+
if len(events.Items) != len(v1Events.Items) {
99+
return false, nil
100+
}
101+
94102
return true, nil
95103
})
96104
if err != nil {
@@ -137,15 +145,17 @@ func TestEventSeries(t *testing.T) {
137145
return false, err
138146
}
139147

140-
if len(events.Items) != 1 {
148+
// Be sure that at least the events we sent in the test were delivered.
149+
// To add any events from the kube-apiserver itself will require this tolerate additional events.
150+
if len(events.Items) < 1 {
141151
return false, nil
142152
}
143153

144154
if events.Items[0].Series == nil {
145155
return false, nil
146156
}
147157

148-
if events.Items[0].Series.Count != 2 {
158+
if events.Items[0].Series.Count < 2 {
149159
return false, fmt.Errorf("expected EventSeries to have a starting count of 2, got: %d", events.Items[0].Series.Count)
150160
}
151161

0 commit comments

Comments
 (0)