Skip to content
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

Testing: add retries for Windows Core ssh issues #1514

Merged
merged 4 commits into from
Nov 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion integration_test/gce/gce_testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ func IsWindows(platform string) bool {
return strings.HasPrefix(platform, "windows-") || strings.HasPrefix(platform, "sql-")
}

// IsWindowsCore returns whether the given platform is a version of Windows core.
func IsWindowsCore(platform string) bool {
return strings.HasPrefix(platform, "windows-") && strings.HasSuffix(platform, "-core")
}

// PlatformKind returns "linux" or "windows" based on the given platform.
func PlatformKind(platform string) string {
if IsWindows(platform) {
Expand Down Expand Up @@ -1305,6 +1310,8 @@ func CreateInstance(origCtx context.Context, logger *log.Logger, options VMOptio
strings.Contains(err.Error(), "Internal error") ||
// Instance creation can also fail due to service unavailability.
strings.Contains(err.Error(), "currently unavailable") ||
// windows-*-core instances sometimes fail to be ssh-able: b/305721001
(IsWindowsCore(options.Platform) && strings.Contains(err.Error(), windowsStartupFailedMessage)) ||
// SLES instances sometimes fail to be ssh-able: b/186426190
(IsSUSE(options.Platform) && strings.Contains(err.Error(), startupFailedMessage)) ||
strings.Contains(err.Error(), prepareSLESMessage)
Expand Down Expand Up @@ -1678,6 +1685,8 @@ func FetchMetadata(ctx context.Context, logger *log.Logger, vm *VM) (map[string]
const (
// Retry errors that look like b/186426190.
startupFailedMessage = "waitForStartLinux() failed: waiting for startup timed out"
// Retry errors that look like b/305721001.
windowsStartupFailedMessage = "waitForStartWindows() failed: ran out of attempts waiting for dummy command to run."
)

func waitForStartWindows(ctx context.Context, logger *log.Logger, vm *VM) error {
Expand All @@ -1696,7 +1705,7 @@ func waitForStartWindows(ctx context.Context, logger *log.Logger, vm *VM) error

backoffPolicy := backoff.WithContext(backoff.NewConstantBackOff(vmInitBackoffDuration), ctx)
if err := backoff.Retry(printFoo, backoffPolicy); err != nil {
return fmt.Errorf("waitForStartWindows() failed: ran out of attempts waiting for dummy command to run. err=%v", err)
return fmt.Errorf("%s err=%v", windowsStartupFailedMessage, err)
}
return nil
}
Expand Down
Loading