From ef43e63e9b0111550bb1ffa7f12fb6643a578177 Mon Sep 17 00:00:00 2001 From: Medya Gh Date: Thu, 20 Feb 2020 15:58:05 -0800 Subject: [PATCH] add miniutes --- test/integration/aaa_download_only_test.go | 3 +-- test/integration/main.go | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/integration/aaa_download_only_test.go b/test/integration/aaa_download_only_test.go index a22212a00f..293ca11884 100644 --- a/test/integration/aaa_download_only_test.go +++ b/test/integration/aaa_download_only_test.go @@ -28,7 +28,6 @@ import ( "runtime" "strings" "testing" - "time" "k8s.io/minikube/pkg/minikube/bootstrapper/images" "k8s.io/minikube/pkg/minikube/config" @@ -38,7 +37,7 @@ import ( func TestDownloadOnly(t *testing.T) { profile := UniqueProfileName("download") - ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute) + ctx, cancel := context.WithTimeout(context.Background(), Minutes(15)) defer Cleanup(t, profile, cancel) // Stores the startup run result for later error messages diff --git a/test/integration/main.go b/test/integration/main.go index bffb12f079..e484bf473d 100644 --- a/test/integration/main.go +++ b/test/integration/main.go @@ -34,6 +34,7 @@ var forceProfile = flag.String("profile", "", "force tests to run against a part var cleanup = flag.Bool("cleanup", true, "cleanup failed test run") var enableGvisor = flag.Bool("gvisor", false, "run gvisor integration test (slow)") var postMortemLogs = flag.Bool("postmortem-logs", true, "show logs after a failed test run") +var slowMachine = flag.Bool("slow-machine", false, "wait longer for tests to finish") // Paths to files - normally set for CI var binaryPath = flag.String("binary", "../../out/minikube", "path to minikube binary") @@ -77,3 +78,11 @@ func ExpectedDefaultDriver() string { func CanCleanup() bool { return *cleanup } + +// Minutes will return timeout in minutes based on how slow the machine is +func Minutes(n int) time.Duration { + if *slowMachine { + return time.Duration(2) * time.Duration(n) * time.Minute + } + return time.Duration(n) * time.Minute +}