mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +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) {
|
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)
|
framework.Failf("Timed out waiting for expected event: %v", event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func expectNoEvent(w watch.Interface, eventType watch.EventType, object runtime.Object) {
|
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)
|
framework.Failf("Unexpected event occurred: %v", event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func waitForEvent(w watch.Interface, expectType watch.EventType, expectObject runtime.Object) (watch.Event, bool) {
|
func waitForEvent(w watch.Interface, expectType watch.EventType, expectObject runtime.Object, duration time.Duration) (watch.Event, bool) {
|
||||||
stopTimer := time.NewTimer(1 * time.Minute)
|
stopTimer := time.NewTimer(duration)
|
||||||
defer stopTimer.Stop()
|
defer stopTimer.Stop()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
|
Loading…
Reference in New Issue
Block a user