mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
Let's keep both checks for now, but in the future we'll be able to remove the check for "firecracker", as the hypervisor name used as part of the GitHub Actions has to match what's used as part of the kata-deploy stuff, which is `fc` (as in `kata-fc for the runtime class) instead of `firecracker`. Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
66 lines
1.9 KiB
Bash
66 lines
1.9 KiB
Bash
#!/usr/bin/env bats
|
|
#
|
|
# Copyright (c) 2018 Intel Corporation
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
load "${BATS_TEST_DIRNAME}/../../common.bash"
|
|
load "${BATS_TEST_DIRNAME}/tests_common.sh"
|
|
|
|
setup() {
|
|
[ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}"
|
|
[ "${KATA_HYPERVISOR}" == "fc" ] && skip "test not working see: ${fc_limitations}"
|
|
|
|
get_pod_config_dir
|
|
}
|
|
|
|
@test "Projected volume" {
|
|
[ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}"
|
|
|
|
password="1f2d1e2e67df"
|
|
username="admin"
|
|
pod_name="test-projected-volume"
|
|
|
|
TMP_FILE=$(mktemp username.XXXX)
|
|
SECOND_TMP_FILE=$(mktemp password.XXXX)
|
|
|
|
# Create files containing the username and password
|
|
echo "$username" > $TMP_FILE
|
|
echo "$password" > $SECOND_TMP_FILE
|
|
|
|
# Package these files into secrets
|
|
kubectl create secret generic user --from-file=$TMP_FILE
|
|
kubectl create secret generic pass --from-file=$SECOND_TMP_FILE
|
|
|
|
# Create pod
|
|
kubectl create -f "${pod_config_dir}/pod-projected-volume.yaml"
|
|
|
|
# Check pod creation
|
|
kubectl wait --for=condition=Ready --timeout=$timeout pod "$pod_name"
|
|
|
|
# Check that the projected sources exists
|
|
cmd="ls /projected-volume | grep username"
|
|
kubectl exec $pod_name -- sh -c "$cmd"
|
|
sec_cmd="ls /projected-volume | grep password"
|
|
kubectl exec $pod_name -- sh -c "$sec_cmd"
|
|
|
|
# Check content of the projected sources
|
|
check_cmd="cat /projected-volume/username*"
|
|
kubectl exec $pod_name -- sh -c "$check_cmd" | grep "$username"
|
|
sec_check_cmd="cat /projected-volume/password*"
|
|
kubectl exec $pod_name -- sh -c "$sec_check_cmd" | grep "$password"
|
|
}
|
|
|
|
teardown() {
|
|
[ "${KATA_HYPERVISOR}" == "firecracker" ] && skip "test not working see: ${fc_limitations}"
|
|
[ "${KATA_HYPERVISOR}" == "fc" ] && skip "test not working see: ${fc_limitations}"
|
|
|
|
# Debugging information
|
|
kubectl describe "pod/$pod_name"
|
|
|
|
rm -f $TMP_FILE $SECOND_TMP_FILE
|
|
kubectl delete pod "$pod_name"
|
|
kubectl delete secret pass user
|
|
}
|