mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Fix checks, amount checking
This commit is contained in:
parent
b63b147d12
commit
9f0c24ddcf
@ -1312,22 +1312,22 @@ retriesLoop:
|
||||
// NOTE the test may need access to the events to see what's going on, such as a change in status
|
||||
actualWatchEvents := scenario(resourceWatch)
|
||||
errs := sets.NewString()
|
||||
watchEventsLoop:
|
||||
// watchEventsLoop:
|
||||
totalValidWatchEvents := 0
|
||||
for watchEventIndex, _ := range expectedWatchEvents {
|
||||
foundExpectedWatchEvent := false
|
||||
watchEventNextIndex := watchEventIndex + 1
|
||||
if watchEventNextIndex >= len(expectedWatchEvents) {
|
||||
continue watchEventsLoop
|
||||
}
|
||||
ExpectEqual(len(expectedWatchEvents) <= len(actualWatchEvents), true, "Error: actual watch events amount must be greater than or equal to expected watch events amount")
|
||||
for actualWatchEventIndex, _ := range actualWatchEvents {
|
||||
if actualWatchEvents[watchEventIndex] == expectedWatchEvents[actualWatchEventIndex] {
|
||||
if actualWatchEvents[watchEventIndex].Type == expectedWatchEvents[actualWatchEventIndex].Type {
|
||||
foundExpectedWatchEvent = true
|
||||
}
|
||||
}
|
||||
if foundExpectedWatchEvent == false {
|
||||
errs.Insert(fmt.Sprintf("Watch event %v not found", expectedWatchEvents[watchEventIndex]))
|
||||
errs.Insert(fmt.Sprintf("Watch event %v not found", expectedWatchEvents[watchEventIndex].Type))
|
||||
}
|
||||
totalValidWatchEvents ++
|
||||
}
|
||||
ExpectEqual(totalValidWatchEvents, len(expectedWatchEvents), "Error: there must be an equal amount of total valid watch events (%v) and expected watch events (%v)", totalValidWatchEvents, len(expectedWatchEvents))
|
||||
// TODO restructure failures handling
|
||||
if errs.Len() > 0 && try < retries {
|
||||
fmt.Errorf("invariants violated:\n* %s", strings.Join(errs.List(), "\n* "))
|
||||
|
Loading…
Reference in New Issue
Block a user