-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Yariv Rachmani <[email protected]>
- Loading branch information
Showing
4 changed files
with
128 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
summary: Test bluechi evel agents | ||
test: | ||
/bin/bash ./test.sh | ||
duration: 10m | ||
tag: ffi | ||
#This tests should run last | ||
order: 70 | ||
|
||
framework: | ||
shell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/bin/bash -euvx | ||
|
||
# shellcheck disable=SC1091 | ||
|
||
. ../common/prepare.sh | ||
|
||
export QM_HOST_REGISTRY_DIR="/var/qm/lib/containers/registry" | ||
export QM_REGISTRY_DIR="/var/lib/containers/registry" | ||
export NUMBER_OF_NODES="${NUMBER_OF_NODES:-2}" | ||
|
||
setup_test_containers_in_qm() { | ||
|
||
#Prepare quadlet files for testing containers | ||
for ((i=1;i<=NUMBER_OF_NODES;i++)); do | ||
info_message "setup_test_containers_in_qm(): prepare quadlet files for bluechi-tester-${i}.container" | ||
cat >> "/etc/qm/containers/systemd/bluechi-tester-${i}.container" <<EOF | ||
[Unit] | ||
Description=bluechi-tester-X | ||
After=local-fs.target | ||
[Container] | ||
Image=dir:/var/lib/containers/registry/tools-ffi:latest | ||
Exec=/root/tests/FFI/bin/bluechi-tester --url="tcp:host=localhost,port=842" \ | ||
--nodename=bluechi-tester-X \ | ||
--numbersignals=11111111 \ | ||
--signal="JobDone" | ||
Network=host | ||
EOF | ||
sed -i -e "s/tester-X/tester-${i}/g" "/etc/qm/containers/systemd/bluechi-tester-${i}.container" | ||
|
||
info_message "setup_test_containers_in_qm(): updating AllowedNodeNames in /etc/bluechi/controller.conf" | ||
#Update controller configuration | ||
sed -i -e '/^AllowedNodeNames=/ s/$/,bluechi-tester-'"${i}"'/' /etc/bluechi/controller.conf | ||
|
||
info_message "setup_test_containers_in_qm(): bluechi-controller reload & restart" | ||
#Reload bluechi-controller | ||
exec_cmd "systemctl daemon-reload" | ||
exec_cmd "systemctl restart bluechi-controller" | ||
|
||
done | ||
|
||
} | ||
|
||
run_test_containers(){ | ||
for ((i=1;i<=NUMBER_OF_NODES;i++)); do | ||
#Reload bluechi-testers in qm | ||
info_message "run_test_containers(): bluechi-tester-${i} reload & restart" | ||
exec_cmd "podman exec qm systemctl daemon-reload" | ||
exec_cmd "podman exec qm systemctl restart bluechi-tester-${i}" | ||
done | ||
} | ||
|
||
disk_cleanup | ||
prepare_test | ||
reload_config | ||
prepare_images | ||
|
||
#Stop QM bluechi-agent | ||
exec_cmd "podman exec -it qm /bin/bash -c \ | ||
\"systemctl stop bluechi-agent\"" | ||
|
||
#Prepare quadlet files for testing containers | ||
setup_test_containers_in_qm | ||
#Run containers through systemd | ||
run_test_containers | ||
|
||
#Check both tests services are on | ||
for ((i=1;i<=NUMBER_OF_NODES;i++)); do | ||
if [ "$(podman exec qm systemctl is-active bluechi-tester-"${i}")" != "active" ]; then | ||
info_message "test() bluechi-tester-${i} is not active" | ||
exit 1 | ||
fi | ||
done | ||
|
||
#check ASIL bluechi-agent is connected | ||
connection_cnt="$(grep -e Connected -e "'localrootfs'" \ | ||
-oc <<< "$(systemctl status --no-pager bluechi-agent)")" | ||
if [ "${connection_cnt}" -ne 1 ]; then | ||
info_message "test() expects ASIL bluechi-agent connection not disturbed" | ||
info_message "test() number of connections found ${connection_cnt}" | ||
exit "${connection_cnt}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters