diff --git a/pkg/skaffold/build/cache/cache_test.go b/pkg/skaffold/build/cache/cache_test.go index 260d12f4edf..81ac17db623 100644 --- a/pkg/skaffold/build/cache/cache_test.go +++ b/pkg/skaffold/build/cache/cache_test.go @@ -30,6 +30,7 @@ import ( "github.com/GoogleContainerTools/skaffold/testutil" "github.com/docker/docker/api/types" yaml "gopkg.in/yaml.v2" + "k8s.io/client-go/tools/clientcmd/api" ) var ( @@ -122,6 +123,8 @@ func Test_NewCache(t *testing.T) { for _, test := range tests { t.Run(test.name, func(t *testing.T) { + restore := testutil.SetupFakeKubernetesContext(t, api.Config{CurrentContext: "cluster1"}) + defer restore() cacheFile := createTempCacheFile(t, test.cacheFileContents) if test.updateCacheFile { diff --git a/pkg/skaffold/runner/dev_test.go b/pkg/skaffold/runner/dev_test.go index 90419de1236..12df300ca5a 100644 --- a/pkg/skaffold/runner/dev_test.go +++ b/pkg/skaffold/runner/dev_test.go @@ -28,6 +28,7 @@ import ( "github.com/GoogleContainerTools/skaffold/pkg/skaffold/sync" "github.com/GoogleContainerTools/skaffold/pkg/skaffold/watch" "github.com/GoogleContainerTools/skaffold/testutil" + "k8s.io/client-go/tools/clientcmd/api" ) type NoopWatcher struct{} @@ -92,6 +93,9 @@ func discardOutput() *config.Output { } func TestDevFailFirstCycle(t *testing.T) { + restore := testutil.SetupFakeKubernetesContext(t, api.Config{CurrentContext: "cluster1"}) + defer restore() + var tests = []struct { description string testBench *TestBench @@ -148,6 +152,9 @@ func TestDevFailFirstCycle(t *testing.T) { } func TestDev(t *testing.T) { + restore := testutil.SetupFakeKubernetesContext(t, api.Config{CurrentContext: "cluster1"}) + defer restore() + var tests = []struct { description string testBench *TestBench @@ -280,6 +287,9 @@ func TestDev(t *testing.T) { } func TestDevSync(t *testing.T) { + restore := testutil.SetupFakeKubernetesContext(t, api.Config{CurrentContext: "cluster1"}) + defer restore() + var tests = []struct { description string testBench *TestBench diff --git a/pkg/skaffold/runner/runner_test.go b/pkg/skaffold/runner/runner_test.go index bd82ebfc571..dfe0c2666e9 100644 --- a/pkg/skaffold/runner/runner_test.go +++ b/pkg/skaffold/runner/runner_test.go @@ -290,6 +290,9 @@ func TestNewForConfig(t *testing.T) { } func TestRun(t *testing.T) { + restore := testutil.SetupFakeKubernetesContext(t, api.Config{CurrentContext: "cluster1"}) + defer restore() + var tests = []struct { description string testBench *TestBench