mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-15 11:22:43 +03:00
Return failure if any of install_modules fails
Add test to verify that install_modules can be skipped and that install_modules returns failure if it fails to update mdev.conf.
This commit is contained in:
parent
4ba3ce17bc
commit
38cbdee6a2
@ -27,16 +27,17 @@ has_cloud_hotplugs() { [ -n "$HOTPLUG_MODULES" ]; }
|
||||
install_hotplugs() {
|
||||
skip_action install_hotplugs && return
|
||||
|
||||
local result
|
||||
local result rc=0
|
||||
|
||||
for module in $HOTPLUG_MODULES; do
|
||||
result='-'
|
||||
echo -n " $module"
|
||||
if type "mod__$module" | grep -q "is a function"; then
|
||||
"mod__$module" && result='+' || result='!'
|
||||
"mod__$module" && result='+' || { result='!'; rc=1; }
|
||||
fi
|
||||
echo -n "($result)"
|
||||
done
|
||||
return $rc
|
||||
}
|
||||
|
||||
: "${HOTPLUG_TYPE:=mdev}"
|
||||
|
||||
@ -8,7 +8,9 @@ export MOCK=echo
|
||||
init_tests \
|
||||
expand_root \
|
||||
expand_root_partition \
|
||||
expand_root_skip
|
||||
expand_root_skip \
|
||||
install_hotplugs_skip \
|
||||
install_hotplugs_fail
|
||||
|
||||
PROVIDERS="aws azure gcp nocloud oci"
|
||||
|
||||
@ -64,3 +66,29 @@ expand_root_skip_body() {
|
||||
done
|
||||
}
|
||||
|
||||
install_hotplugs_skip_body() {
|
||||
fake_bin test-install-hotplugs <<-EOF
|
||||
#!/bin/sh
|
||||
SKIP_INIT_ACTIONS=install_hotplugs
|
||||
. "$srcdir"/lib/tiny-cloud/init-early
|
||||
install_hotplugs
|
||||
EOF
|
||||
for provider in $PROVIDERS; do
|
||||
CLOUD="$provider" atf_check \
|
||||
-o match:'^ SKIPPING$' \
|
||||
test-install-hotplugs
|
||||
done
|
||||
}
|
||||
|
||||
install_hotplugs_fail_body() {
|
||||
fake_bin test-install-hotplugs <<-EOF
|
||||
#!/bin/sh
|
||||
HOTPLUG_MODULES="vnic_eth_hotplug"
|
||||
. "$srcdir"/lib/tiny-cloud/init-early
|
||||
install_hotplugs
|
||||
EOF
|
||||
CLOUD=aws atf_check -s not-exit:0 \
|
||||
-o match:"^ vnic_eth_hotplug\(!\)$" \
|
||||
test-install-hotplugs
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user