Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Commit 7fdafd2

Browse files
committed
fixup! fixup! fixup! fixup! Simplify assertion type
1 parent 48418e5 commit 7fdafd2

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

ci/integration/integration_test.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,21 @@ func init() {
4343
}
4444
}
4545

46+
// write session tokens to the given container runner
47+
func headlessLogin(ctx context.Context, t *testing.T, runner *tcli.ContainerRunner) {
48+
creds := login(ctx, t)
49+
cmd := exec.CommandContext(ctx, "mkdir -p ~/.config/coder && cat > ~/.config/coder/session")
50+
51+
// !IMPORTANT: be careful that this does not appear in logs
52+
cmd.Stdin = strings.NewReader(creds.token)
53+
runner.RunCmd(cmd).Assert(t,
54+
tcli.Success(),
55+
)
56+
runner.Run(ctx, fmt.Sprintf("echo -ne %s > ~/.config/coder/url", creds.url)).Assert(t,
57+
tcli.Success(),
58+
)
59+
}
60+
4661
func TestCoderCLI(t *testing.T) {
4762
t.Parallel()
4863
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5)
@@ -77,17 +92,7 @@ func TestCoderCLI(t *testing.T) {
7792
tcli.StdoutEmpty(),
7893
)
7994

80-
creds := login(ctx, t)
81-
cmd := exec.CommandContext(ctx, "mkdir -p ~/.config/coder && cat > ~/.config/coder/session")
82-
83-
// !IMPORTANT: be careful that this does not appear in logs
84-
cmd.Stdin = strings.NewReader(creds.token)
85-
c.RunCmd(cmd).Assert(t,
86-
tcli.Success(),
87-
)
88-
c.Run(ctx, fmt.Sprintf("echo -ne %s > ~/.config/coder/url", creds.url)).Assert(t,
89-
tcli.Success(),
90-
)
95+
headlessLogin(ctx, t, c)
9196

9297
c.Run(ctx, "coder envs").Assert(t,
9398
tcli.Success(),

0 commit comments

Comments
 (0)