Retry mysql check, as mysqld doesn't come up fully configured immediately

pull/5761/head
tstromberg 2019-10-29 13:13:33 -07:00
parent 0b7a54079d
commit a2e684cf8d
1 changed files with 10 additions and 7 deletions

View File

@ -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)
}
}