mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-01 11:56:29 +00:00
tests: k8s/tests_common: avoid using regex
More straightforward implementation of hard_coded_policy_tests_enabled, that avoids ShellCheck warning: warning: Remove quotes from right-hand side of =~ to match as a regex rather than literally. [SC2076] Signed-off-by: Dan Mihai <dmihai@microsoft.com>
This commit is contained in:
parent
d83b8349a2
commit
835c6814d7
@ -274,13 +274,28 @@ add_copy_from_guest_to_policy_settings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hard_coded_policy_tests_enabled() {
|
hard_coded_policy_tests_enabled() {
|
||||||
|
local enabled="no"
|
||||||
# CI is testing hard-coded policies just on a the platforms listed here. Outside of CI,
|
# CI is testing hard-coded policies just on a the platforms listed here. Outside of CI,
|
||||||
# users can enable testing of the same policies (plus the auto-generated policies) by
|
# users can enable testing of the same policies (plus the auto-generated policies) by
|
||||||
# specifying AUTO_GENERATE_POLICY=yes.
|
# specifying AUTO_GENERATE_POLICY=yes.
|
||||||
local enabled_hypervisors="qemu-coco-dev qemu-sev qemu-snp qemu-tdx"
|
local -r enabled_hypervisors=("qemu-coco-dev" "qemu-sev" "qemu-snp" "qemu-tdx")
|
||||||
[[ " ${enabled_hypervisors} " =~ " ${KATA_HYPERVISOR} " ]] || \
|
for enabled_hypervisor in "${enabled_hypervisors[@]}"
|
||||||
[[ "${KATA_HOST_OS}" == "cbl-mariner" ]] || \
|
do
|
||||||
auto_generate_policy_enabled
|
if [[ "${enabled_hypervisor}" == "${KATA_HYPERVISOR}" ]]; then
|
||||||
|
enabled="yes"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "${enabled}" == "no" && "${KATA_HOST_OS}" == "cbl-mariner" ]]; then
|
||||||
|
enabled="yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "${enabled}" == "no" ]] && auto_generate_policy_enabled; then
|
||||||
|
enabled="yes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
[[ "${enabled}" == "yes" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
add_allow_all_policy_to_yaml() {
|
add_allow_all_policy_to_yaml() {
|
||||||
|
Loading…
Reference in New Issue
Block a user