Skip to content

Commit df5d68b

Browse files
committed
fix: update e2e tests to expect exit code 130 on user decline
Signed-off-by: Ishwar <ishwarcm@iitbhilai.ac.in>
1 parent cbf7940 commit df5d68b

2 files changed

Lines changed: 2 additions & 4 deletions

File tree

pkg/compose/publish_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,13 @@ services:
104104
}
105105

106106
func Test_preChecks_sensitive_data_detected_decline(t *testing.T) {
107-
108107
dir := t.TempDir()
109108
envPath := dir + "/secrets.env"
110109
secretData := `AWS_SECRET_ACCESS_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"`
111110
err := os.WriteFile(envPath, []byte(secretData), 0o600)
112111
assert.NilError(t, err)
113112

114113
project := &types.Project{
115-
116114
Services: types.Services{
117115
"web": {
118116
Name: "web",

pkg/e2e/publish_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ or remove sensitive data from your Compose configuration
7171
"-p", projectName, "publish", "test/test", "--dry-run")
7272
cmd.Stdin = strings.NewReader("n\n")
7373
res := icmd.RunCmd(cmd)
74-
res.Assert(t, icmd.Expected{ExitCode: 0})
74+
res.Assert(t, icmd.Expected{ExitCode: 130})
7575
out := res.Combined()
7676
assert.Assert(t, strings.Contains(out, "you are about to publish bind mounts declaration within your OCI artifact."), out)
7777
assert.Assert(t, strings.Contains(out, "e2e/fixtures/publish:/user-data"), out)
@@ -111,7 +111,7 @@ or remove sensitive data from your Compose configuration
111111
"-p", projectName, "publish", "test/test", "--with-env", "--dry-run")
112112
cmd.Stdin = strings.NewReader("n\n")
113113
res := icmd.RunCmd(cmd)
114-
res.Assert(t, icmd.Expected{ExitCode: 0})
114+
res.Assert(t, icmd.Expected{ExitCode: 130})
115115

116116
output := res.Combined()
117117
assert.Assert(t, strings.Contains(output, "you are about to publish sensitive data within your OCI artifact.\n"), output)

0 commit comments

Comments
 (0)