mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Seperate timer durations for expectEvent and expectNoEvent
This commit is contained in:
parent
cbdbcb515b
commit
121bc9c838
@ -179,19 +179,19 @@ func updatePod(f *framework.Framework, name string, update updatePodFunc) (*v1.P
|
||||
}
|
||||
|
||||
func expectEvent(w watch.Interface, eventType watch.EventType, object runtime.Object) {
|
||||
if event, ok := waitForEvent(w, eventType, object); !ok {
|
||||
if event, ok := waitForEvent(w, eventType, object, 1*time.Minute); !ok {
|
||||
framework.Failf("Timed out waiting for expected event: %v", event)
|
||||
}
|
||||
}
|
||||
|
||||
func expectNoEvent(w watch.Interface, eventType watch.EventType, object runtime.Object) {
|
||||
if event, ok := waitForEvent(w, eventType, object); ok {
|
||||
if event, ok := waitForEvent(w, eventType, object, 10*time.Second); ok {
|
||||
framework.Failf("Unexpected event occurred: %v", event)
|
||||
}
|
||||
}
|
||||
|
||||
func waitForEvent(w watch.Interface, expectType watch.EventType, expectObject runtime.Object) (watch.Event, bool) {
|
||||
stopTimer := time.NewTimer(1 * time.Minute)
|
||||
func waitForEvent(w watch.Interface, expectType watch.EventType, expectObject runtime.Object, duration time.Duration) (watch.Event, bool) {
|
||||
stopTimer := time.NewTimer(duration)
|
||||
defer stopTimer.Stop()
|
||||
for {
|
||||
select {
|
||||
|
Loading…
Reference in New Issue
Block a user