Skip to content

Commit

Permalink
fix: unit tests: fail TestWorkflow's shell command on error (#5238)
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 authored Mar 22, 2024
1 parent 6088d5b commit 6e5fa6f
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions pkg/tcl/testworkflowstcl/testworkflowprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TestProcessBasic(t *testing.T) {
"-r", fmt.Sprintf("=%s", sig[0].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down Expand Up @@ -196,7 +196,7 @@ func TestProcessBasicEnvReference(t *testing.T) {
"-r", fmt.Sprintf("=%s", sig[0].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{
Expand Down Expand Up @@ -265,7 +265,7 @@ func TestProcessMultipleSteps(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -288,7 +288,7 @@ func TestProcessMultipleSteps(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-2"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-2"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down Expand Up @@ -357,7 +357,7 @@ func TestProcessNestedSteps(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s&&%s", sig[0].Ref(), sig[1].Ref(), sig[2].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -380,7 +380,7 @@ func TestProcessNestedSteps(t *testing.T) {
"-r", fmt.Sprintf("%s=%s&&%s", sig[1].Ref(), sig[1].Children()[0].Ref(), sig[1].Children()[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-2"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-2"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -403,7 +403,7 @@ func TestProcessNestedSteps(t *testing.T) {
"-r", fmt.Sprintf("%s=%s&&%s", sig[1].Ref(), sig[1].Children()[0].Ref(), sig[1].Children()[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-3"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-3"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -426,7 +426,7 @@ func TestProcessNestedSteps(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s&&%s", sig[0].Ref(), sig[1].Ref(), sig[2].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-4"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-4"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down Expand Up @@ -495,7 +495,7 @@ func TestProcessOptionalSteps(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[2].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -517,7 +517,7 @@ func TestProcessOptionalSteps(t *testing.T) {
"-r", fmt.Sprintf("%s=%s&&%s", sig[1].Ref(), sig[1].Children()[0].Ref(), sig[1].Children()[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-2"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-2"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -539,7 +539,7 @@ func TestProcessOptionalSteps(t *testing.T) {
"-r", fmt.Sprintf("%s=%s&&%s", sig[1].Ref(), sig[1].Children()[0].Ref(), sig[1].Children()[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-3"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-3"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -562,7 +562,7 @@ func TestProcessOptionalSteps(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[2].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-4"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-4"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down Expand Up @@ -631,7 +631,7 @@ func TestProcessNegativeSteps(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s&&%s", sig[0].Ref(), sig[1].Ref(), sig[2].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -655,7 +655,7 @@ func TestProcessNegativeSteps(t *testing.T) {
"-r", fmt.Sprintf("%s.v=%s&&%s", sig[1].Ref(), sig[1].Children()[0].Ref(), sig[1].Children()[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-2"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-2"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -679,7 +679,7 @@ func TestProcessNegativeSteps(t *testing.T) {
"-r", fmt.Sprintf("%s.v=%s&&%s", sig[1].Ref(), sig[1].Children()[0].Ref(), sig[1].Children()[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-3"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-3"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -702,7 +702,7 @@ func TestProcessNegativeSteps(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s&&%s", sig[0].Ref(), sig[1].Ref(), sig[2].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-4"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-4"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down Expand Up @@ -764,7 +764,7 @@ func TestProcessNegativeContainerStep(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -788,7 +788,7 @@ func TestProcessNegativeContainerStep(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-2"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-2"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down Expand Up @@ -851,7 +851,7 @@ func TestProcessOptionalContainerStep(t *testing.T) {
"-r", fmt.Sprintf("=%s", sig[0].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -873,7 +873,7 @@ func TestProcessOptionalContainerStep(t *testing.T) {
"-c", fmt.Sprintf("%s=passed", sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-2"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-2"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down Expand Up @@ -946,7 +946,7 @@ func TestProcessLocalContent(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -969,7 +969,7 @@ func TestProcessLocalContent(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-2"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-2"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down Expand Up @@ -1048,7 +1048,7 @@ func TestProcessGlobalContent(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test"},
Args: []string{defaultShell, "-c", "set -e\nshell-test"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand All @@ -1071,7 +1071,7 @@ func TestProcessGlobalContent(t *testing.T) {
"-r", fmt.Sprintf("=%s&&%s", sig[0].Ref(), sig[1].Ref()),
"--",
},
Args: []string{defaultShell, "-c", "shell-test-2"},
Args: []string{defaultShell, "-c", "set -e\nshell-test-2"},
WorkingDir: "",
EnvFrom: []corev1.EnvFromSource(nil),
Env: []corev1.EnvVar{{Name: "CI", Value: "1"}},
Expand Down

0 comments on commit 6e5fa6f

Please sign in to comment.