From 6ffad93865ded3b5267b016812e6667f65dfe38e Mon Sep 17 00:00:00 2001 From: Wayne Starr Date: Fri, 11 Oct 2024 11:29:47 -0600 Subject: [PATCH] add tests --- src/test/e2e/runner_test.go | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/test/e2e/runner_test.go b/src/test/e2e/runner_test.go index bf0a1f1..e9bd4fd 100644 --- a/src/test/e2e/runner_test.go +++ b/src/test/e2e/runner_test.go @@ -209,7 +209,7 @@ func TestTaskRunner(t *testing.T) { require.NotContains(t, stdErr, "default") }) - t.Run("run list tasks", func(t *testing.T) { + t.Run("run --list tasks", func(t *testing.T) { t.Parallel() gitRev, err := e2e.GetGitRevision() if err != nil { @@ -242,6 +242,41 @@ func TestTaskRunner(t *testing.T) { require.Contains(t, stdOut, "remote:echo-var") }) + t.Run("run --list=md tasks", func(t *testing.T) { + t.Parallel() + gitRev, err := e2e.GetGitRevision() + if err != nil { + return + } + setVar := fmt.Sprintf("GIT_REVISION=%s", gitRev) + + stdOut, stdErr, err := e2e.Maru("run", "--list=md", setVar, "--file", "src/test/tasks/tasks.yaml") + + require.NoError(t, err, stdOut, stdErr) + require.Contains(t, stdOut, "|------|-------------|") + require.Contains(t, stdOut, "echo-env-var") + require.Contains(t, stdOut, "Test that env vars take precedence") + require.Contains(t, stdOut, "remote-import") + require.Contains(t, stdOut, "action") + }) + + t.Run("run --list-all=md tasks", func(t *testing.T) { + t.Parallel() + gitRev, err := e2e.GetGitRevision() + if err != nil { + return + } + setVar := fmt.Sprintf("GIT_REVISION=%s", gitRev) + + stdOut, stdErr, err := e2e.Maru("run", "--list-all=md", "--set", setVar, "--file", "src/test/tasks/tasks.yaml") + require.NoError(t, err, stdOut, stdErr) + require.Contains(t, stdOut, "|------|-------------|") + require.Contains(t, stdOut, "echo-env-var") + require.Contains(t, stdOut, "Test that env vars take precedence") + require.Contains(t, stdOut, "foo:foobar") + require.Contains(t, stdOut, "remote:echo-var") + }) + t.Run("test bad call to zarf tools wait-for", func(t *testing.T) { t.Parallel() _, stdErr, err := e2e.Maru("run", "wait-fail", "--file", "src/test/tasks/tasks.yaml")