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

Allow integration tests to pass on fresh deployments #131

Merged
merged 2 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion ci/integration/ssh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
})
}
10 changes: 5 additions & 5 deletions ci/integration/users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy