From 17d541d351a021dcfccea8738171a145721ba816 Mon Sep 17 00:00:00 2001 From: Alexander Demichev Date: Wed, 20 Apr 2022 11:45:22 +0200 Subject: [PATCH 1/2] Perform DNS check earlier in the tests Check that DNS works before trying to wait for the service, because service wait function relies on nslookup. Signed-off-by: Alexander Demichev --- connectivity/check/deployment.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/connectivity/check/deployment.go b/connectivity/check/deployment.go index 2bf5aa210c..fc54f43e91 100644 --- a/connectivity/check/deployment.go +++ b/connectivity/check/deployment.go @@ -572,6 +572,16 @@ func (ct *ConnectivityTest) validateDeployment(ctx context.Context) error { } } + // Set the timeout for all DNS lookup retries + dnsCtx, cancel := context.WithTimeout(ctx, ct.params.ipCacheTimeout()) + defer cancel() + for _, cp := range ct.clientPods { + err := ct.waitForDNS(dnsCtx, cp) + if err != nil { + return err + } + } + perfPods, err := ct.client.ListPods(ctx, ct.params.TestNamespace, metav1.ListOptions{LabelSelector: "kind=" + kindPerfName}) if err != nil { return fmt.Errorf("unable to list perf pods: %w", err) @@ -692,16 +702,6 @@ func (ct *ConnectivityTest) validateDeployment(ctx context.Context) error { } } - // Set the timeout for all DNS lookup retries - dnsCtx, cancel := context.WithTimeout(ctx, ct.params.ipCacheTimeout()) - defer cancel() - for _, cp := range ct.clientPods { - err := ct.waitForDNS(dnsCtx, cp) - if err != nil { - return err - } - } - return nil } From 0a41c22f298b7c6102234ea73a2c8dc27361b0c5 Mon Sep 17 00:00:00 2001 From: Alexander Demichev Date: Wed, 20 Apr 2022 11:47:47 +0200 Subject: [PATCH 2/2] Add friendly error message for failed service wait Make logs print only namespace and name of the service, not dump of the entire object Signed-off-by: Alexander Demichev --- connectivity/check/deployment.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connectivity/check/deployment.go b/connectivity/check/deployment.go index fc54f43e91..c3977e094e 100644 --- a/connectivity/check/deployment.go +++ b/connectivity/check/deployment.go @@ -813,7 +813,7 @@ func (ct *ConnectivityTest) waitForService(ctx context.Context, service Service) for { select { case <-ctx.Done(): - return fmt.Errorf("timeout reached waiting for %s", service) + return fmt.Errorf("timeout reached waiting for service %s", service.Name()) default: }