Ensure deploy render only does not make kubectl calls
@@ -28,7 +28,9 @@ import (
"k8s.io/client-go/tools/clientcmd/api"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/build"
+ "github.com/GoogleContainerTools/skaffold/pkg/skaffold/config"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/deploy"
+ "github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubectl"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes"
"github.com/GoogleContainerTools/skaffold/pkg/skaffold/runner/runcontext"
"github.com/GoogleContainerTools/skaffold/testutil"
@@ -133,3 +135,26 @@ func TestDeployNamespace(t *testing.T) {
})
}
}
+
+func TestSkaffoldDeployRenderOnly(t *testing.T) {
+ testutil.Run(t, "does not make kubectl calls", func(t *testutil.T) {
+ runCtx := &runcontext.RunContext{
+ Opts: config.SkaffoldOptions{
+ Namespace: "testNamespace",
+ RenderOnly: true,
+ },
+ KubeContext: "does-not-exist",
+ }
+
+ r := SkaffoldRunner{
+ runCtx: runCtx,
+ kubectlCLI: kubectl.NewFromRunContext(runCtx),
+ deployer: getDeployer(runCtx),
+ }
+ var builds []build.Artifact
+
+ err := r.Deploy(context.Background(), ioutil.Discard, builds)
+
+ t.CheckNoError(err)
+ })
+}
