From 44423fb2ca59547968b1028427b5ea0c3176d5a8 Mon Sep 17 00:00:00 2001 From: guofutan Date: Thu, 6 Jan 2022 14:21:22 +0800 Subject: [PATCH] fix: keep the API: postrender.NewExec and Add NewExecWithArgs Signed-off-by: guofutan --- pkg/postrender/exec_test.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/pkg/postrender/exec_test.go b/pkg/postrender/exec_test.go index 4b753db63..2e955e3e5 100644 --- a/pkg/postrender/exec_test.go +++ b/pkg/postrender/exec_test.go @@ -116,7 +116,24 @@ func TestExecRun(t *testing.T) { testpath, cleanup := setupTestingScript(t) defer cleanup() - renderer, err := NewExec(testpath, []string{}) + renderer, err := NewExec(testpath) + require.NoError(t, err) + + output, err := renderer.Run(bytes.NewBufferString("FOOTEST")) + is.NoError(err) + is.Contains(output.String(), "BARTEST") +} + +func TestNewExecWithArgsRun(t *testing.T) { + if runtime.GOOS == "windows" { + // the actual Run test uses a basic sed example, so skip this test on windows + t.Skip("skipping on windows") + } + is := assert.New(t) + testpath, cleanup := setupTestingScript(t) + defer cleanup() + + renderer, err := NewExecWithArgs(testpath, []string{}) require.NoError(t, err) output, err := renderer.Run(bytes.NewBufferString("FOOTEST"))