From a2e684cf8dd0e554987fcc3dc17edcfe0d962fe8 Mon Sep 17 00:00:00 2001 From: tstromberg Date: Tue, 29 Oct 2019 13:13:33 -0700 Subject: [PATCH] Retry mysql check, as mysqld doesn't come up fully configured immediately --- test/integration/functional_test.go | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/integration/functional_test.go b/test/integration/functional_test.go index 66f99f608c..3837a80abe 100644 --- a/test/integration/functional_test.go +++ b/test/integration/functional_test.go @@ -486,14 +486,17 @@ func validateMySQL(ctx context.Context, t *testing.T, profile string) { t.Fatalf("%s failed: %v", rr.Args, err) } - names, err := PodWait(ctx, t, profile, "default", "app=mysql", 2*time.Minute) - if err != nil { - t.Errorf("nginx: %v", err) + // Retry, as mysqld first comes up without users configured. Scan for names in case of a reschedule. + mysql := func() error { + names, err := PodWait(ctx, t, profile, "default", "app=mysql", 5*time.Second) + if err != nil { + return err + } + rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "exec", names[0], "--", "mysql", "-ppassword", "-e", "show databases;")) + return err } - - rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "exec", names[0], "--", "mysql", "-ppassword", "-e", "show databases;")) - if err != nil { - t.Fatalf("%s failed: %v", rr.Args, err) + if err = retry.Expo(mysql, 1*time.Second, 2*time.Minute); err != nil { + t.Errorf("mysql failing: %v", err) } }