Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Racer159 committed Oct 11, 2024
1 parent 7bb999b commit 6ffad93
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/test/e2e/runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 6ffad93

Please sign in to comment.