Add integration test for run --render-only --render-output
@@ -17,10 +17,12 @@ limitations under the License.
package integration
import (
+ "io/ioutil"
"strings"
"testing"
"github.com/GoogleContainerTools/skaffold/integration/skaffold"
+ "github.com/GoogleContainerTools/skaffold/testutil"
)
func TestRun(t *testing.T) {
@@ -134,6 +136,39 @@ func TestRun(t *testing.T) {
}
}
+func TestRunRenderOnly(t *testing.T) {
+ if testing.Short() || RunOnGCP() {
+ t.Skip("skipping kind integration test")
+ }
+
+ testutil.Run(t, "it persist rendered manifest to provided filepath", func(tu *testutil.T) {
+ tmpDir := tu.NewTempDir()
+ renderPath := tmpDir.Path("output.yaml")
+
+ test := struct {
+ description string
+ renderPath string
+ args []string
+ dir string
+ pods []string
+ }{
+ args: []string{"--render-only", "--render-output", renderPath},
+ dir: "examples/getting-started",
+ pods: []string{"getting-started"},
+ }
+
+ skaffold.Run(test.args...).InDir(test.dir).RunOrFail(t)
+
+ dat, err := ioutil.ReadFile(renderPath)
+ tu.CheckNoError(err)
+
+ exp, err := ioutil.ReadFile(test.dir + "/k8s-pod.yaml")
+ tu.CheckNoError(err)
+
+ tu.CheckDeepEqual(string(exp), string(dat))
+ })
+}
+
func TestRunGCPOnly(t *testing.T) {
MarkIntegrationTest(t, NeedsGcp)
