-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: Reduce flake for integration test TestStartStop #6999
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -595,6 +595,20 @@ func validateProfileCmd(ctx context.Context, t *testing.T, profile string) { | |
|
||
// validateServiceCmd asserts basic "service" command functionality | ||
func validateServiceCmd(ctx context.Context, t *testing.T, profile string) { | ||
// to avoid https://github.com/kubernetes/minikube/issues/6997 | ||
// adding this logic to minikube start is not necessary but useful for rare test flakes | ||
saReady := func() error { // check if default service account is created. | ||
if _, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "serviceaccount", "default")); err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to be covering up an actual flaw that users can face. Shouldn't the start command wait for this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about this, this rarely happens but it eats up 13 seconds of waiting on my machine. I have a feeling that would not be helpful There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I understand it, this integration test is surfacing a bug: minikube start + kubectl is currently racy. As it is successfully capturing a rare race condition (yay!), we should either fix it, or leave it present, not paper over it. I believe the right way to go about this is to add a I would argue that defaulting this flag to 'true' would be more in the spirit of minikube (reliability > latency) , but I do understand the trade-off here, and am comfortable leaving it as false for the time being. Thoughts? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tstromberg |
||
t.Logf("temporary error waiting for default service account: %v", err) | ||
return fmt.Errorf("Error waiting for default service account %v", err) | ||
} | ||
return nil | ||
} | ||
|
||
if err := retry.Expo(saReady, 500*time.Microsecond, time.Second*30); err != nil { | ||
t.Errorf("default service account was not created in 30 seconds.: %v", err) | ||
} | ||
|
||
rr, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "create", "deployment", "hello-node", "--image=gcr.io/hello-minikube-zero-install/hello-node")) | ||
if err != nil { | ||
t.Logf("%s failed: %v (may not be an error)", rr.Args, err) | ||
|
@@ -710,6 +724,20 @@ func validateSSHCmd(ctx context.Context, t *testing.T, profile string) { | |
|
||
// validateMySQL validates a minimalist MySQL deployment | ||
func validateMySQL(ctx context.Context, t *testing.T, profile string) { | ||
// to avoid https://github.com/kubernetes/minikube/issues/6997 | ||
// adding this logic to minikube start is not necessary but useful for rare test flakes | ||
saReady := func() error { // check if default service account is created. | ||
if _, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "get", "serviceaccount", "default")); err != nil { | ||
t.Logf("temporary error waiting for default service account: %v", err) | ||
return fmt.Errorf("Error waiting for default service account %v", err) | ||
} | ||
return nil | ||
} | ||
|
||
if err := retry.Expo(saReady, 500*time.Microsecond, time.Second*30); err != nil { | ||
t.Errorf("default service account was not created in 30 seconds.: %v", err) | ||
} | ||
|
||
rr, err := Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "replace", "--force", "-f", filepath.Join(*testdataDir, "mysql.yaml"))) | ||
if err != nil { | ||
t.Fatalf("%s failed: %v", rr.Args, err) | ||
|
@@ -725,7 +753,7 @@ func validateMySQL(ctx context.Context, t *testing.T, profile string) { | |
rr, err = Run(t, exec.CommandContext(ctx, "kubectl", "--context", profile, "exec", names[0], "--", "mysql", "-ppassword", "-e", "show databases;")) | ||
return err | ||
} | ||
if err = retry.Expo(mysql, 5*time.Second, 180*time.Second); err != nil { | ||
if err = retry.Expo(mysql, 5*time.Second, Seconds(180)); err != nil { | ||
t.Errorf("mysql failing: %v", err) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seconds is not a good name for this function.
How about "ApproximateSeconds" or "SecondsWithMultiplier"?