mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Fixed based on comments
This commit is contained in:
parent
38a6f38c6d
commit
eeeffbb183
@ -57,6 +57,10 @@ const (
|
|||||||
// Should the test restart petset clusters?
|
// Should the test restart petset clusters?
|
||||||
// TODO: enable when we've productionzed bringup of pets in this e2e.
|
// TODO: enable when we've productionzed bringup of pets in this e2e.
|
||||||
restartCluster = false
|
restartCluster = false
|
||||||
|
|
||||||
|
// Timeout for reads from databases running on pets.
|
||||||
|
readTimeout = 60 * time.Second
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Time: 25m, slow by design.
|
// Time: 25m, slow by design.
|
||||||
@ -805,15 +809,20 @@ func ExpectNoError(err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func pollReadWithTimeout(pet petTester, petNumber int, key, expectedVal string) error {
|
func pollReadWithTimeout(pet petTester, petNumber int, key, expectedVal string) error {
|
||||||
return wait.PollImmediate(time.Second, timeout, func() (bool, error) {
|
err := wait.PollImmediate(time.Second, readTimeout, func() (bool, error) {
|
||||||
val := pet.read(petNumber, key)
|
val := pet.read(petNumber, key)
|
||||||
if val == "" {
|
if val == "" {
|
||||||
return false, nil
|
return false, nil
|
||||||
} else if val != expectedVal {
|
} else if val != expectedVal {
|
||||||
return false, fmt.Errorf("Expected value %v, found %v", expectedVal, val)
|
return false, fmt.Errorf("expected value %v, found %v", expectedVal, val)
|
||||||
}
|
}
|
||||||
return true, nil
|
return true, nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if err == wait.ErrWaitTimeout {
|
||||||
|
return fmt.Errorf("timed out when trying to read value for key %v from pet %d", key, petNumber)
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func isInitialized(pod api.Pod) bool {
|
func isInitialized(pod api.Pod) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user