add test for empty contexts

This commit is contained in:
Sulabh Chaturvedi 2020-08-19 14:27:37 +01:00
parent 0154216c33
commit 39f8e1ab7c
2 changed files with 23 additions and 0 deletions

View File

@ -242,3 +242,11 @@ load common
run ${COMMAND} -c
[ "$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
View 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: {}