MCPcopy Index your code
hub / github.com/coder/coder / TestScaleTestCreateWorkspaces

Function TestScaleTestCreateWorkspaces

cli/exp_scaletest_test.go:17–65  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

15)
16
17func TestScaleTestCreateWorkspaces(t *testing.T) {
18 t.Parallel()
19
20 if testutil.RaceEnabled() {
21 t.Skip("Skipping due to race detector")
22 }
23
24 // This test only validates that the CLI command accepts known arguments.
25 // More thorough testing is done in scaletest/createworkspaces/run_test.go.
26 ctx, cancelFunc := context.WithTimeout(context.Background(), testutil.WaitLong)
27 defer cancelFunc()
28
29 log := slogtest.Make(t, &slogtest.Options{IgnoreErrors: true})
30 client := coderdtest.New(t, &coderdtest.Options{
31 // We are not including any provisioner daemons because we do not actually
32 // build any workspaces here.
33 Logger: &log,
34 })
35 _ = coderdtest.CreateFirstUser(t, client)
36
37 // Write a parameters file.
38 tDir := t.TempDir()
39 outputFile := filepath.Join(tDir, "output.json")
40
41 inv, root := clitest.New(t, "exp", "scaletest", "create-workspaces",
42 "--count", "2",
43 "--template", "doesnotexist",
44 "--no-cleanup",
45 "--no-wait-for-agents",
46 "--concurrency", "2",
47 "--timeout", "30s",
48 "--job-timeout", "15s",
49 "--cleanup-concurrency", "1",
50 "--cleanup-timeout", "30s",
51 "--cleanup-job-timeout", "15s",
52 "--output", "text",
53 "--output", "json:"+outputFile,
54 "--parameter", "foo=baz",
55 "--rich-parameter-file", "/path/to/some/parameter/file.ext",
56 "--max-failures", "1",
57 )
58 clitest.SetupConfig(t, client, root)
59 pty := ptytest.New(t)
60 inv.Stdout = pty.Output()
61 inv.Stderr = pty.Output()
62
63 err := inv.WithContext(ctx).Run()
64 require.ErrorContains(t, err, "could not find template \"doesnotexist\" in any organization")
65}
66
67// This test just validates that the CLI command accepts its known arguments.
68// A more comprehensive test is performed in workspacetraffic/run_test.go

Callers

nothing calls this directly

Calls 11

RaceEnabledFunction · 0.92
NewFunction · 0.92
CreateFirstUserFunction · 0.92
NewFunction · 0.92
SetupConfigFunction · 0.92
NewFunction · 0.92
SkipMethod · 0.80
WithContextMethod · 0.80
TempDirMethod · 0.65
OutputMethod · 0.65
RunMethod · 0.65

Tested by

no test coverage detected