This repository was archived by the owner on Jan 22, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Test fully specifying client config with env var #18
+168
−93
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
dc93fd0
Rework test with bats
NickCao eee5c87
Update test
NickCao 24970d3
Rework entire test
NickCao 59b6260
Test env
NickCao ae28008
No trace
NickCao 3acee95
--show-output-of-passing-tests
NickCao 39c70f7
Fix process termination
NickCao 1b4421e
Check for existence of the client/exporter objects themselves
NickCao 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
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,106 @@ | ||
| setup_file() { | ||
| # create clients | ||
| jmp admin create client test-client-oidc --unsafe --out /dev/null \ | ||
| --oidc-username dex:test-client-oidc | ||
| jmp admin create client test-client-sa --unsafe --out /dev/null \ | ||
| --oidc-username dex:system:serviceaccount:default:test-client-sa | ||
| jmp admin create client test-client-legacy --unsafe --save | ||
|
|
||
| # create exporters | ||
| jmp admin create exporter test-exporter-oidc --out /dev/null \ | ||
| --oidc-username dex:test-exporter-oidc \ | ||
| --label example.com/board=oidc | ||
| jmp admin create exporter test-exporter-sa --out /dev/null \ | ||
| --oidc-username dex:system:serviceaccount:default:test-exporter-sa \ | ||
| --label example.com/board=sa | ||
| jmp admin create exporter test-exporter-legacy --save \ | ||
| --label example.com/board=legacy | ||
| } | ||
|
|
||
| teardown_file() { | ||
| # delete clients | ||
| jmp admin delete client test-client-oidc | ||
| jmp admin delete client test-client-sa | ||
| jmp admin delete client test-client-legacy | ||
|
|
||
| # delete exporters | ||
| jmp admin delete exporter test-exporter-oidc | ||
| jmp admin delete exporter test-exporter-sa | ||
| jmp admin delete exporter test-exporter-legacy | ||
| } | ||
|
|
||
| @test "can run our script" { | ||
| jmp config client list | ||
| jmp config exporter list | ||
|
|
||
| jmp login --client test-client-oidc \ | ||
| --endpoint "$ENDPOINT" --namespace default --name test-client-oidc \ | ||
| --issuer https://dex.dex.svc.cluster.local:5556 \ | ||
| --username test-client-oidc@example.com --password password --unsafe | ||
|
|
||
| jmp login --client test-client-sa \ | ||
| --endpoint "$ENDPOINT" --namespace default --name test-client-sa \ | ||
| --issuer https://dex.dex.svc.cluster.local:5556 \ | ||
| --connector-id kubernetes \ | ||
| --token $(kubectl create -n default token test-client-sa) --unsafe | ||
|
|
||
| jmp login --exporter test-exporter-oidc \ | ||
| --endpoint "$ENDPOINT" --namespace default --name test-exporter-oidc \ | ||
| --issuer https://dex.dex.svc.cluster.local:5556 \ | ||
| --username test-exporter-oidc@example.com --password password | ||
|
|
||
| jmp login --exporter test-exporter-sa \ | ||
| --endpoint "$ENDPOINT" --namespace default --name test-exporter-sa \ | ||
| --issuer https://dex.dex.svc.cluster.local:5556 \ | ||
| --connector-id kubernetes \ | ||
| --token $(kubectl create -n default token test-exporter-sa) | ||
|
|
||
| go run github.com/mikefarah/yq/v4@latest -i ". * load(\"$GITHUB_ACTION_PATH/exporter.yaml\")" \ | ||
| /etc/jumpstarter/exporters/test-exporter-oidc.yaml | ||
| go run github.com/mikefarah/yq/v4@latest -i ". * load(\"$GITHUB_ACTION_PATH/exporter.yaml\")" \ | ||
| /etc/jumpstarter/exporters/test-exporter-sa.yaml | ||
| go run github.com/mikefarah/yq/v4@latest -i ". * load(\"$GITHUB_ACTION_PATH/exporter.yaml\")" \ | ||
| /etc/jumpstarter/exporters/test-exporter-legacy.yaml | ||
|
NickCao marked this conversation as resolved.
|
||
|
|
||
| jmp config client list | ||
| jmp config exporter list | ||
|
|
||
| jmp run --exporter test-exporter-oidc & | ||
| jmp run --exporter test-exporter-sa & | ||
| jmp run --exporter test-exporter-legacy & | ||
|
|
||
| kubectl -n default wait --for=condition=Online --for=condition=Registered \ | ||
| exporters.jumpstarter.dev/test-exporter-oidc | ||
| kubectl -n default wait --for=condition=Online --for=condition=Registered \ | ||
| exporters.jumpstarter.dev/test-exporter-sa | ||
| kubectl -n default wait --for=condition=Online --for=condition=Registered \ | ||
| exporters.jumpstarter.dev/test-exporter-legacy | ||
|
|
||
| jmp config client use test-client-oidc | ||
|
|
||
| jmp create lease --selector example.com/board=oidc --duration 1d | ||
| jmp get leases | ||
| jmp get exporters | ||
| jmp delete leases --all | ||
|
|
||
| jmp admin get client | ||
| jmp admin get exporter | ||
| jmp admin get lease | ||
|
|
||
| jmp run --exporter test-exporter-oidc & | ||
| kubectl -n default wait --for=condition=Online --for=condition=Registered \ | ||
| exporters.jumpstarter.dev/test-exporter-oidc | ||
|
|
||
| jmp shell --client test-client-oidc --selector example.com/board=oidc j power on | ||
| jmp shell --client test-client-sa --selector example.com/board=sa j power on | ||
| jmp shell --client test-client-legacy --selector example.com/board=legacy j power on | ||
|
|
||
| kubectl -n default get secret test-client-oidc-client | ||
| kubectl -n default get secret test-exporter-oidc-exporter | ||
|
|
||
| jmp admin delete client test-client-oidc -d | ||
| jmp admin delete exporter test-exporter-oidc -d | ||
|
|
||
| ! kubectl -n default get secret test-client-oidc-client | ||
| ! kubectl -n default get secret test-exporter-oidc-exporter | ||
| } | ||
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.