Skip to content

Commit dda5a9f

Browse files
committed
test(e2e): remove -o json flag (non-TTY auto-detects json)
1 parent 09257c7 commit dda5a9f

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

test/e2e/helpers_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func newSandbox(t *testing.T, extraArgs ...string) SandboxView { //nolint:unused
141141
safeName := sanitiseName(t.Name())
142142
name := fmt.Sprintf("e2e-%s-%s", runID, safeName)
143143

144-
args := []string{"sandbox", "create", "-o", "json", "--name", name}
144+
args := []string{"sandbox", "create", "--name", name}
145145
if testShape != "" {
146146
args = append(args, "--shape", testShape)
147147
}
@@ -178,7 +178,7 @@ func newSandbox(t *testing.T, extraArgs ...string) SandboxView { //nolint:unused
178178

179179
waitRunning(t, id)
180180

181-
getOut, getErr, getCode := runCLI("sandbox", "get", "-o", "json", id)
181+
getOut, getErr, getCode := runCLI("sandbox", "get", id)
182182
if getCode != 0 {
183183
t.Fatalf("sandbox get failed after create (exit %d)\nstdout: %s\nstderr: %s", getCode, getOut, getErr)
184184
}
@@ -193,7 +193,7 @@ func waitRunning(t *testing.T, id string) { //nolint:unused // called by newSand
193193
deadline := time.Now().Add(waitRunningCap)
194194
var lastStatus string
195195
for time.Now().Before(deadline) {
196-
stdout, _, code := runCLI("sandbox", "get", "-o", "json", id)
196+
stdout, _, code := runCLI("sandbox", "get", id)
197197
if code == 0 {
198198
var view struct {
199199
Status string `json:"status"`

test/e2e/lifecycle_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestLifecycle(t *testing.T) {
1818
// Step 2: Get — verify the sandbox is reachable and fields match.
1919
getCtx, getCancel := context.WithTimeout(context.Background(), defaultTimeout)
2020
defer getCancel()
21-
getOut, getErr, getCode := runCLICtx(getCtx, "sandbox", "get", "-o", "json", sb.ID)
21+
getOut, getErr, getCode := runCLICtx(getCtx, "sandbox", "get", sb.ID)
2222
if getCode != 0 {
2323
t.Fatalf("sandbox get failed (exit %d)\nstdout: %s\nstderr: %s", getCode, getOut, getErr)
2424
}
@@ -36,7 +36,7 @@ func TestLifecycle(t *testing.T) {
3636
// Step 3: Edit — set auto-pause to 30m (1800 seconds).
3737
editCtx, editCancel := context.WithTimeout(context.Background(), defaultTimeout)
3838
defer editCancel()
39-
editOut, editErr, editCode := runCLICtx(editCtx, "sandbox", "edit", sb.ID, "--auto-pause", "30m", "-o", "json")
39+
editOut, editErr, editCode := runCLICtx(editCtx, "sandbox", "edit", sb.ID, "--auto-pause", "30m")
4040
if editCode != 0 {
4141
t.Fatalf("sandbox edit failed (exit %d)\nstdout: %s\nstderr: %s", editCode, editOut, editErr)
4242
}
@@ -51,7 +51,7 @@ func TestLifecycle(t *testing.T) {
5151
// Step 4: Pause — command polls internally and renders JSON when not on TTY.
5252
pauseCtx, pauseCancel := context.WithTimeout(context.Background(), createTimeout)
5353
defer pauseCancel()
54-
pauseOut, pauseErr, pauseCode := runCLICtx(pauseCtx, "sandbox", "pause", sb.ID, "-o", "json")
54+
pauseOut, pauseErr, pauseCode := runCLICtx(pauseCtx, "sandbox", "pause", sb.ID)
5555
if pauseCode != 0 {
5656
t.Fatalf("sandbox pause failed (exit %d)\nstdout: %s\nstderr: %s", pauseCode, pauseOut, pauseErr)
5757
}
@@ -63,7 +63,7 @@ func TestLifecycle(t *testing.T) {
6363
// Step 5: Resume — command polls internally and renders JSON when not on TTY.
6464
resumeCtx, resumeCancel := context.WithTimeout(context.Background(), createTimeout)
6565
defer resumeCancel()
66-
resumeOut, resumeErr, resumeCode := runCLICtx(resumeCtx, "sandbox", "resume", sb.ID, "-o", "json")
66+
resumeOut, resumeErr, resumeCode := runCLICtx(resumeCtx, "sandbox", "resume", sb.ID)
6767
if resumeCode != 0 {
6868
t.Fatalf("sandbox resume failed (exit %d)\nstdout: %s\nstderr: %s", resumeCode, resumeOut, resumeErr)
6969
}
@@ -78,7 +78,7 @@ func TestLifecycle(t *testing.T) {
7878
_ = forkName // no --name flag; kept for tracing only
7979
forkCtx, forkCancel := context.WithTimeout(context.Background(), createTimeout)
8080
defer forkCancel()
81-
forkOut, forkErr, forkCode := runCLICtx(forkCtx, "sandbox", "fork", sb.ID, "-o", "json")
81+
forkOut, forkErr, forkCode := runCLICtx(forkCtx, "sandbox", "fork", sb.ID)
8282
if forkCode != 0 {
8383
t.Fatalf("sandbox fork failed (exit %d)\nstdout: %s\nstderr: %s", forkCode, forkOut, forkErr)
8484
}
@@ -103,7 +103,7 @@ func TestLifecycle(t *testing.T) {
103103
// Verify removal: get should fail with a non-zero exit (404).
104104
verCtx, verCancel := context.WithTimeout(context.Background(), defaultTimeout)
105105
defer verCancel()
106-
_, _, verCode := runCLICtx(verCtx, "sandbox", "get", "-o", "json", sb.ID)
106+
_, _, verCode := runCLICtx(verCtx, "sandbox", "get", sb.ID)
107107
if verCode == 0 {
108108
t.Errorf("expected non-zero exit after rm, but sandbox get succeeded for %q", sb.ID)
109109
}

test/e2e/main_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func TestMain(m *testing.M) {
8787
// with the lowest vcpu+mem_mib sum. Falls back to empty string on any error
8888
// so create calls get the server's default.
8989
func discoverSmallestShape() string {
90-
stdout, _, code := runCLI("sandbox", "shapes", "-o", "json")
90+
stdout, _, code := runCLI("sandbox", "shapes")
9191
if code != 0 || strings.TrimSpace(stdout) == "" {
9292
return ""
9393
}
@@ -115,7 +115,7 @@ func discoverSmallestShape() string {
115115

116116
// presweep deletes any existing sandboxes whose names start with "e2e-".
117117
func presweep() {
118-
stdout, _, code := runCLI("sandbox", "list", "-o", "json", "--all")
118+
stdout, _, code := runCLI("sandbox", "list", "--all")
119119
if code != 0 || strings.TrimSpace(stdout) == "" {
120120
return
121121
}
@@ -139,7 +139,7 @@ func presweep() {
139139

140140
// postsweep is deferred in TestMain; best-effort delete of e2e- sandboxes.
141141
func postsweep() {
142-
stdout, _, code := runCLI("sandbox", "list", "-o", "json", "--all")
142+
stdout, _, code := runCLI("sandbox", "list", "--all")
143143
if code != 0 || strings.TrimSpace(stdout) == "" {
144144
return
145145
}

test/e2e/readonly_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type ShapeView struct {
1919
// TestShapes asserts that `sandbox shapes -o json` returns a non-empty list
2020
// of shapes with expected fields populated.
2121
func TestShapes(t *testing.T) {
22-
stdout, stderr, code := runCLI("sandbox", "shapes", "-o", "json")
22+
stdout, stderr, code := runCLI("sandbox", "shapes")
2323
if code != 0 {
2424
t.Fatalf("sandbox shapes exited %d\nstdout: %s\nstderr: %s", code, stdout, stderr)
2525
}
@@ -44,7 +44,7 @@ func TestShapes(t *testing.T) {
4444
// TestCatalog asserts that `sandbox catalog -o json` exits 0 and returns a
4545
// non-empty JSON array where the first item has a recognisable key.
4646
func TestCatalog(t *testing.T) {
47-
stdout, stderr, code := runCLI("sandbox", "catalog", "-o", "json")
47+
stdout, stderr, code := runCLI("sandbox", "catalog")
4848
if code != 0 {
4949
t.Fatalf("sandbox catalog exited %d\nstdout: %s\nstderr: %s", code, stdout, stderr)
5050
}
@@ -68,7 +68,7 @@ func TestCatalog(t *testing.T) {
6868
// TestRootfs asserts that `sandbox rootfs -o json` exits 0 and returns a
6969
// non-nil, non-empty JSON value.
7070
func TestRootfs(t *testing.T) {
71-
stdout, stderr, code := runCLI("sandbox", "rootfs", "-o", "json")
71+
stdout, stderr, code := runCLI("sandbox", "rootfs")
7272
if code != 0 {
7373
t.Fatalf("sandbox rootfs exited %d\nstdout: %s\nstderr: %s", code, stdout, stderr)
7474
}
@@ -96,7 +96,7 @@ func TestRootfs(t *testing.T) {
9696
// TestTemplateList asserts that `sandbox template list -o json` exits 0 and
9797
// returns valid JSON (empty or non-empty slice).
9898
func TestTemplateList(t *testing.T) {
99-
stdout, stderr, code := runCLI("sandbox", "template", "list", "-o", "json")
99+
stdout, stderr, code := runCLI("sandbox", "template", "list")
100100
if code != 0 {
101101
t.Fatalf("sandbox template list exited %d\nstdout: %s\nstderr: %s", code, stdout, stderr)
102102
}
@@ -111,7 +111,7 @@ func TestTemplateList(t *testing.T) {
111111
// TestList asserts that `sandbox list -o json` exits 0 and returns valid JSON.
112112
// An empty slice is acceptable since the account may have no sandboxes.
113113
func TestList(t *testing.T) {
114-
stdout, stderr, code := runCLI("sandbox", "list", "-o", "json")
114+
stdout, stderr, code := runCLI("sandbox", "list")
115115
if code != 0 {
116116
t.Fatalf("sandbox list exited %d\nstdout: %s\nstderr: %s", code, stdout, stderr)
117117
}
@@ -124,7 +124,7 @@ func TestList(t *testing.T) {
124124
func TestGet(t *testing.T) {
125125
sb := newSandbox(t)
126126

127-
stdout, stderr, code := runCLI("sandbox", "get", "-o", "json", sb.ID)
127+
stdout, stderr, code := runCLI("sandbox", "get", sb.ID)
128128
if code != 0 {
129129
t.Fatalf("sandbox get exited %d\nstdout: %s\nstderr: %s", code, stdout, stderr)
130130
}

0 commit comments

Comments
 (0)