mirror of
https://github.com/kata-containers/kata-containers.git
synced 2026-02-22 06:43:41 +00:00
tests: k8s-optional-empty-secret.bats policy
Auto-generate policy in k8s-optional-empty-secret.bats, now that genpolicy suppprts optional secret-based volumes. Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
@@ -12,7 +12,17 @@ setup() {
|
||||
get_pod_config_dir
|
||||
|
||||
pod_yaml="${pod_config_dir}/pod-optional-empty-secret.yaml"
|
||||
add_allow_all_policy_to_yaml "${pod_yaml}"
|
||||
|
||||
# Add policy to the pod yaml
|
||||
policy_settings_dir="$(create_tmp_policy_settings_dir "${pod_config_dir}")"
|
||||
|
||||
command1=(sh -c ls /empty-secret)
|
||||
add_exec_to_policy_settings "${policy_settings_dir}" "${command1[@]}"
|
||||
|
||||
command2=(sh -c ls /optional-missing-secret)
|
||||
add_exec_to_policy_settings "${policy_settings_dir}" "${command2[@]}"
|
||||
|
||||
auto_generate_policy "${policy_settings_dir}" "${pod_yaml}"
|
||||
}
|
||||
|
||||
@test "Optional and Empty Secret Volume for a pod" {
|
||||
@@ -29,8 +39,8 @@ setup() {
|
||||
kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
|
||||
|
||||
# Check secret folders exist
|
||||
kubectl exec $pod_name -- sh -c ls /empty-secret
|
||||
kubectl exec $pod_name -- sh -c ls /optional-missing-secret
|
||||
kubectl exec $pod_name -- "${command1[@]}"
|
||||
kubectl exec $pod_name -- "${command2[@]}"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
@@ -39,4 +49,6 @@ teardown() {
|
||||
|
||||
kubectl delete pod "$pod_name"
|
||||
kubectl delete secret "$secret_name"
|
||||
|
||||
delete_tmp_policy_settings_dir "${policy_settings_dir}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user