mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-06-29 16:56:48 +00:00
E2E tests
This commit is contained in:
parent
566c259359
commit
f7af8b8d27
@ -27,6 +27,14 @@ get_context() {
|
|||||||
kubectl config current-context
|
kubectl config current-context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_user() {
|
||||||
|
kubectl config get-users | grep "${1}"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_cluster() {
|
||||||
|
kubectl config get-clusters | grep "${1}"
|
||||||
|
}
|
||||||
|
|
||||||
switch_context() {
|
switch_context() {
|
||||||
kubectl config use-context "${1}"
|
kubectl config use-context "${1}"
|
||||||
}
|
}
|
||||||
|
@ -230,6 +230,28 @@ load common
|
|||||||
[[ "$output" = "user2@cluster1" ]]
|
[[ "$output" = "user2@cluster1" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "delete context including referenced user and cluster" {
|
||||||
|
use_config config1
|
||||||
|
|
||||||
|
run ${COMMAND} -D "user1@cluster1"
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ -z "$(get_user user1)" ]]
|
||||||
|
[[ -z "$(get_cluster cluster1)" ]]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "delete context retain referenced cluster" {
|
||||||
|
use_config config2
|
||||||
|
|
||||||
|
run ${COMMAND} -D "user1@cluster1"
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ -z "$(get_user user1)" ]]
|
||||||
|
[[ -n "$(get_user user2)" ]]
|
||||||
|
[[ -n "$(get_cluster cluster1)" ]]
|
||||||
|
}
|
||||||
|
|
||||||
@test "unset selected context" {
|
@test "unset selected context" {
|
||||||
use_config config2
|
use_config config2
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user