mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-08-07 02:13:55 +00:00
add test for empty contexts
This commit is contained in:
parent
0154216c33
commit
39f8e1ab7c
@ -242,3 +242,11 @@ load common
|
|||||||
run ${COMMAND} -c
|
run ${COMMAND} -c
|
||||||
[ "$status" -ne 0 ]
|
[ "$status" -ne 0 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "display msg on empty context" {
|
||||||
|
use_config config3
|
||||||
|
run ${COMMAND}
|
||||||
|
echo "$output"
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" = "warning: No kubectl context found" ]]
|
||||||
|
}
|
||||||
|
15
test/testdata/config3
vendored
Normal file
15
test/testdata/config3
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# config with no context
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
clusters:
|
||||||
|
- cluster:
|
||||||
|
server: ""
|
||||||
|
name: cluster1
|
||||||
|
contexts:
|
||||||
|
- context:
|
||||||
|
current-context: ""
|
||||||
|
kind: Config
|
||||||
|
preferences: {}
|
||||||
|
users:
|
||||||
|
- name: user1
|
||||||
|
user: {}
|
Loading…
Reference in New Issue
Block a user