diff --git a/ci/integration/ssh_test.go b/ci/integration/ssh_test.go index 273e3850..3882b719 100644 --- a/ci/integration/ssh_test.go +++ b/ci/integration/ssh_test.go @@ -5,14 +5,29 @@ import ( "testing" "cdr.dev/coder-cli/ci/tcli" + "cdr.dev/coder-cli/coder-sdk" ) func TestSSH(t *testing.T) { t.Parallel() run(t, "ssh-coder-cli-tests", func(t *testing.T, ctx context.Context, c *tcli.ContainerRunner) { headlessLogin(ctx, t, c) - c.Run(ctx, "coder config-ssh").Assert(t, + + // TODO remove this once we can create an environment if there aren't any + var envs []coder.Environment + c.Run(ctx, "coder envs ls --output json").Assert(t, tcli.Success(), + tcli.StdoutJSONUnmarshal(&envs), + ) + + assert := tcli.Success() + + // if we don't have any environments, "coder config-ssh" will fail + if len(envs) == 0 { + assert = tcli.Error() + } + c.Run(ctx, "coder config-ssh").Assert(t, + assert, ) }) } diff --git a/ci/integration/users_test.go b/ci/integration/users_test.go index 05d81c6a..2138aeed 100644 --- a/ci/integration/users_test.go +++ b/ci/integration/users_test.go @@ -21,16 +21,16 @@ func TestUsers(t *testing.T) { headlessLogin(ctx, t, c) var user coder.User - c.Run(ctx, `coder users ls --output json | jq -c '.[] | select( .username == "charlie")'`).Assert(t, + c.Run(ctx, `coder users ls --output json | jq -c '.[] | select( .username == "admin")'`).Assert(t, tcli.Success(), tcli.StdoutJSONUnmarshal(&user), ) - assert.Equal(t, "user email is as expected", "charlie@coder.com", user.Email) - assert.Equal(t, "username is as expected", "Charlie", user.Name) + assert.Equal(t, "user email is as expected", "admin", user.Email) + assert.Equal(t, "name is as expected", "admin", user.Name) - c.Run(ctx, "coder users ls --output human | grep charlie").Assert(t, + c.Run(ctx, "coder users ls --output human | grep admin").Assert(t, tcli.Success(), - tcli.StdoutMatches("charlie"), + tcli.StdoutMatches("admin"), ) c.Run(ctx, "coder logout").Assert(t,