Skip to content

Commit ae67d6d

Browse files
committed
Migrated a few additional tests
1 parent c103fac commit ae67d6d

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

internal/cmd/cloud_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ func TestCheckCloudLogin(t *testing.T) {
148148
conf: cloudapi.Config{
149149
Token: null.StringFrom("valid-token"),
150150
},
151-
wantErr: errStackNotConfigured,
151+
wantErr: errUserUnauthenticated,
152152
},
153153
{
154154
name: "zero stack ID returns stack not configured error",
155155
conf: cloudapi.Config{
156156
Token: null.StringFrom("valid-token"),
157157
StackID: null.IntFrom(0),
158158
},
159-
wantErr: errStackNotConfigured,
159+
wantErr: errUserUnauthenticated,
160160
},
161161
}
162162

internal/cmd/tests/cmd_cloud_run_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export default function() {};`
219219

220220
stdout := ts.Stdout.String()
221221
t.Log(stdout)
222-
assert.Contains(t, stdout, "stack must be configured")
222+
assert.Contains(t, stdout, "must first authenticate")
223223
})
224224
}
225225

@@ -232,8 +232,8 @@ func makeTestState(tb testing.TB, script string, cliFlags []string, expExitCode
232232
require.NoError(tb, fsext.WriteFile(ts.FS, filepath.Join(ts.Cwd, "test.js"), []byte(script), 0o644))
233233
ts.CmdArgs = append(append([]string{"k6", "cloud", "run"}, cliFlags...), "test.js")
234234
ts.ExpectedExitCode = int(expExitCode)
235-
ts.Env["K6_CLOUD_TOKEN"] = "foo" // doesn't matter, we mock the cloud
236-
ts.Env["K6_CLOUD_STACK_ID"] = "1234" // doesn't matter, we mock the cloud
235+
ts.Env["K6_CLOUD_TOKEN"] = "foo" // doesn't matter, we mock the cloud
236+
ts.Env["K6_CLOUD_STACK_ID"] = "1234" // doesn't matter, we mock the cloud
237237

238238
return ts
239239
}

internal/cmd/tests/cmd_cloud_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func runCloudTests(t *testing.T, setupCmd setupCommandFunc) {
5555

5656
stdout := ts.Stdout.String()
5757
t.Log(stdout)
58-
assert.Contains(t, stdout, `stack must be configured`)
58+
assert.Contains(t, stdout, `must first authenticate`)
5959
})
6060

6161
t.Run("TestCloudLoggedInWithScriptToken", func(t *testing.T) {
@@ -229,10 +229,10 @@ func runCloudTests(t *testing.T, setupCmd setupCommandFunc) {
229229
require.NoError(t, fsext.WriteFile(ts.FS, filepath.Join(ts.Cwd, "archive.tar"), data, 0o644))
230230

231231
ts.CmdArgs = []string{"k6", "cloud", "--verbose", "--log-output=stdout", "archive.tar"}
232-
ts.Env["K6_SHOW_CLOUD_LOGS"] = "false" // no mock for the logs yet
232+
ts.Env["K6_SHOW_CLOUD_LOGS"] = "false" // no mock for the logs yet
233233
ts.Env["K6_CLOUD_HOST"] = srv.URL
234-
ts.Env["K6_CLOUD_TOKEN"] = "foo" // doesn't matter, we mock the cloud
235-
ts.Env["K6_CLOUD_STACK_ID"] = "1234" // doesn't matter, we mock the cloud
234+
ts.Env["K6_CLOUD_TOKEN"] = "foo" // doesn't matter, we mock the cloud
235+
ts.Env["K6_CLOUD_STACK_ID"] = "1234" // doesn't matter, we mock the cloud
236236

237237
cmd.ExecuteWithGlobalState(ts.GlobalState)
238238

@@ -344,11 +344,11 @@ func getSimpleCloudTestState(t *testing.T, script []byte, setupCmd setupCommandF
344344
ts := NewGlobalTestState(t)
345345
require.NoError(t, fsext.WriteFile(ts.FS, filepath.Join(ts.Cwd, "test.js"), script, 0o644))
346346
ts.CmdArgs = setupCmd(cliFlags)
347-
ts.Env["K6_SHOW_CLOUD_LOGS"] = "false" // no mock for the logs yet
347+
ts.Env["K6_SHOW_CLOUD_LOGS"] = "false" // no mock for the logs yet
348348
ts.Env["K6_CLOUD_HOST"] = srv.URL
349-
ts.Env["K6_CLOUD_TOKEN"] = "foo" // doesn't matter, we mock the cloud
350-
ts.Env["K6_CLOUD_STACK_ID"] = "1234" // doesn't matter, we mock the cloud
351-
ts.Env["K6_CLOUD_PROJECT_ID"] = "1234" // doesn't matter, we mock the cloud
349+
ts.Env["K6_CLOUD_TOKEN"] = "foo" // doesn't matter, we mock the cloud
350+
ts.Env["K6_CLOUD_STACK_ID"] = "1234" // doesn't matter, we mock the cloud
351+
ts.Env["K6_CLOUD_PROJECT_ID"] = "1234" // doesn't matter, we mock the cloud
352352

353353
return ts
354354
}

0 commit comments

Comments
 (0)