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

Commit ccf3893

Browse files
committed
fixup! Add integration test for CODER_TOKEN static auth
1 parent 6a8c9f2 commit ccf3893

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ci/integration/statictokens_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,23 @@ func TestStaticAuth(t *testing.T) {
2727
tcli.GetResult(&result),
2828
)
2929

30-
c.Run(ctx, "rm -rf ~/.config/coder")
30+
// remove loging credentials
31+
c.Run(ctx, "rm -rf ~/.config/coder").Assert(t,
32+
tcli.Success(),
33+
)
3134

32-
cmd := exec.CommandContext(ctx, "sh", "-c", fmt.Sprintf("export CODER_URL=%s && export CODER_TOKEN=$(cat) && coder envs ls", os.Getenv("CODER_URL")))
35+
// make requests with token environment variable authentication
36+
cmd := exec.CommandContext(ctx, "sh", "-c",
37+
fmt.Sprintf("export CODER_URL=%s && export CODER_TOKEN=$(cat) && coder envs ls", os.Getenv("CODER_URL")),
38+
)
3339
cmd.Stdin = strings.NewReader(string(result.Stdout))
3440
c.RunCmd(cmd).Assert(t,
3541
tcli.Success(),
3642
)
3743

44+
// should error when the environment variabels aren't set
3845
c.Run(ctx, "coder envs ls").Assert(t,
39-
tcli.Success(),
46+
tcli.Error(),
4047
)
4148
})
4249
}

0 commit comments

Comments
 (0)