mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-09-16 07:48:24 +00:00
Introduce -c/--current options for kubectx/kubens (#171)
Per #127 the user community wants to have this feature, primarily as -c and --current flags. Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
@@ -113,6 +113,33 @@ load common
|
||||
[ "$status" -eq 1 ]
|
||||
}
|
||||
|
||||
@test "-c/--current fails when no context set" {
|
||||
use_config config1
|
||||
|
||||
run "${COMMAND}" -c
|
||||
echo "$output"
|
||||
[ $status -eq 1 ]
|
||||
run "${COMMAND}" --current
|
||||
echo "$output"
|
||||
[ $status -eq 1 ]
|
||||
}
|
||||
|
||||
@test "-c/--current prints the current context" {
|
||||
use_config config1
|
||||
|
||||
run "${COMMAND}" user1@cluster1
|
||||
[ $status -eq 0 ]
|
||||
|
||||
run "${COMMAND}" -c
|
||||
echo "$output"
|
||||
[ $status -eq 0 ]
|
||||
[[ "$output" = "user1@cluster1" ]]
|
||||
run "${COMMAND}" --current
|
||||
echo "$output"
|
||||
[ $status -eq 0 ]
|
||||
[[ "$output" = "user1@cluster1" ]]
|
||||
}
|
||||
|
||||
@test "rename context" {
|
||||
use_config config2
|
||||
|
||||
|
Reference in New Issue
Block a user