use PollUntilContextTimeout to replace PollImmediateWithContext in test

Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
This commit is contained in:
bzsuni
2023-10-19 22:50:21 +08:00
parent de054fbf94
commit 8775d805fa
55 changed files with 140 additions and 140 deletions

View File

@@ -526,7 +526,7 @@ func (config *NetworkingTestConfig) executeCurlCmd(ctx context.Context, cmd stri
const retryTimeout = 30 * time.Second
podName := config.HostTestContainerPod.Name
var msg string
if pollErr := wait.PollImmediateWithContext(ctx, retryInterval, retryTimeout, func(ctx context.Context) (bool, error) {
if pollErr := wait.PollUntilContextTimeout(ctx, retryInterval, retryTimeout, true, func(ctx context.Context) (bool, error) {
stdout, err := e2epodoutput.RunHostCmd(config.Namespace, podName, cmd)
if err != nil {
msg = fmt.Sprintf("failed executing cmd %v in %v/%v: %v", cmd, config.Namespace, podName, err)
@@ -1172,7 +1172,7 @@ func UnblockNetwork(ctx context.Context, from string, to string) {
// WaitForService waits until the service appears (exist == true), or disappears (exist == false)
func WaitForService(ctx context.Context, c clientset.Interface, namespace, name string, exist bool, interval, timeout time.Duration) error {
err := wait.PollImmediateWithContext(ctx, interval, timeout, func(ctx context.Context) (bool, error) {
err := wait.PollUntilContextTimeout(ctx, interval, timeout, true, func(ctx context.Context) (bool, error) {
_, err := c.CoreV1().Services(namespace).Get(ctx, name, metav1.GetOptions{})
switch {
case err == nil: