This repository was archived by the owner on Aug 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Add custom prefix devurl #74
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5d92778
Add custom prefix devurl
11f797a
Reverted err response
362ddc7
Enabled error response JSON body output
c71c3c9
Add urls ls subcmd; add -o [human | json] support matching users cmd
cc55a4a
Add future support for integration devurl tests
f50cfc0
Merge branch 'master' into 4411-coder-cli-named-devurls
1dc6c3b
use requireSuccess(); log.Fatal() where appropriate; change 'del' to …
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
package integration | ||
|
||
import ( | ||
"context" | ||
"testing" | ||
"time" | ||
|
||
"cdr.dev/coder-cli/ci/tcli" | ||
"cdr.dev/slog/sloggers/slogtest/assert" | ||
) | ||
|
||
func TestDevURLCLI(t *testing.T) { | ||
t.Parallel() | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5) | ||
defer cancel() | ||
|
||
c, err := tcli.NewContainerRunner(ctx, &tcli.ContainerConfig{ | ||
Image: "codercom/enterprise-dev", | ||
Name: "coder-cli-devurl-tests", | ||
BindMounts: map[string]string{ | ||
binpath: "/bin/coder", | ||
}, | ||
}) | ||
assert.Success(t, "new run container", err) | ||
defer c.Close() | ||
|
||
c.Run(ctx, "which coder").Assert(t, | ||
tcli.Success(), | ||
tcli.StdoutMatches("/usr/sbin/coder"), | ||
tcli.StderrEmpty(), | ||
) | ||
|
||
c.Run(ctx, "coder urls ls").Assert(t, | ||
tcli.Error(), | ||
) | ||
|
||
// The following cannot be enabled nor verified until either the | ||
// integration testing dogfood target has environments created, or | ||
// we implement the 'env create' command for coder-cli to create our | ||
// own here. | ||
|
||
// If we were to create an env ourselves ... we could test devurls something like | ||
|
||
// // == Login | ||
// headlessLogin(ctx, t, c) | ||
|
||
// // == urls ls should fail w/o supplying an envname | ||
// c.Run(ctx, "coder urls ls").Assert(t, | ||
// tcli.Error(), | ||
// ) | ||
|
||
// // == env creation should succeed | ||
// c.Run(ctx, "coder envs create env1 --from image1 --cores 1 --ram 2gb --disk 10gb --nogpu").Assert(t, | ||
// tcli.Success()) | ||
|
||
// // == urls ls should succeed for a newly-created environment | ||
// var durl entclient.DevURL | ||
// c.Run(ctx, `coder urls ls -o json`).Assert(t, | ||
// tcli.Success(), | ||
// jsonUnmarshals(&durl), // though if a new env, durl should be empty | ||
// ) | ||
|
||
// // == devurl creation w/default PRIVATE access | ||
// c.Run(ctx, `coder urls create env1 3000`).Assert(t, | ||
// tcli.Success()) | ||
|
||
// // == devurl create w/access == AUTHED | ||
// c.Run(ctx, `coder urls create env1 3001 --access=AUTHED`).Assert(t, | ||
// tcli.Success()) | ||
|
||
// // == devurl create with name | ||
// c.Run(ctx, `coder urls create env1 3002 --access=PUBLIC --name=foobar`).Assert(t, | ||
// tcli.Success()) | ||
|
||
// // == devurl ls should return well-formed entries incl. one with AUTHED access | ||
// c.Run(ctx, `coder urls ls env1 -o json | jq -c '.[] | select( .access == "AUTHED")'`).Assert(t, | ||
// tcli.Success(), | ||
// jsonUnmarshals(&durl)) | ||
|
||
// // == devurl ls should return well-formed entries incl. one with name 'foobar' | ||
// c.Run(ctx, `coder urls ls env1 -o json | jq -c '.[] | select( .name == "foobar")'`).Assert(t, | ||
// tcli.Success(), | ||
// jsonUnmarshals(&durl)) | ||
|
||
// // == devurl rm should function | ||
// c.Run(ctx, `coder urls rm env1 3002`).Assert(t, | ||
// tcli.Success()) | ||
|
||
// // == removed devurl should no longer be there | ||
// c.Run(ctx, `coder urls ls env1 -o json | jq -c '.[] | select( .name == "foobar")'`).Assert(t, | ||
// tcli.Error(), | ||
// jsonUnmarshals(&durl)) | ||
|
||
} | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.