Skip to content

Commit

Permalink
microcloud/test/suites: Add consistent github action support for tests
Browse files Browse the repository at this point in the history
Signed-off-by: Max Asnaashari <[email protected]>
  • Loading branch information
masnax committed Dec 16, 2024
1 parent 7227a83 commit bf564d0
Show file tree
Hide file tree
Showing 8 changed files with 1,032 additions and 625 deletions.
31 changes: 31 additions & 0 deletions microcloud/test/includes/check.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/bin/bash
# Miscellaneous test checks.

check_dependencies() {
# shellcheck disable=SC3043
local dep missing
missing=""

# XXX: make sure we don't detect lxd-installer wrapper by accident
[ -x /usr/sbin/lxc ] && chmod -x /usr/sbin/lxc /usr/sbin/lxd

for dep in "$@"; do
if ! command -v "$dep" >/dev/null 2>&1; then
[ "$missing" ] && missing="$missing $dep" || missing="$dep"
Expand All @@ -15,6 +19,12 @@ check_dependencies() {
echo "Missing dependencies: $missing" >&2
exit 1
fi

# Instances need to be able to self-report on their state
if ! lxc info | sed -ne '/^api_extensions:/,/^[^-]/ s/^- //p' | grep -qxF "instance_ready_state"; then
echo "Missing LXD instance_ready_state extension" >&2
exit 1
fi
}

check_empty() {
Expand All @@ -24,3 +34,24 @@ check_empty() {
false
fi
}

check_snap_channels() {
if [ "${LXD_SNAP_CHANNEL}" != "5.21/edge" ]; then
echo "::warning::lxd channel not set to 5.21/edge, continuing anyway"
fi

non_edge=""
if [ "${MICROCEPH_SNAP_CHANNEL}" != "latest/edge" ]; then
non_edge="${non_edge} microceph"
fi
if [ "${MICROCLOUD_SNAP_CHANNEL}" != "latest/edge" ]; then
non_edge="${non_edge} microcloud"
fi
if [ "${MICROOVN_SNAP_CHANNEL}" != "latest/edge" ]; then
non_edge="${non_edge} microovn"
fi

for snap in ${non_edge}; do
echo "::warning::${snap} channel not set to latest/edge, continuing anyway"
done
}
Loading

0 comments on commit bf564d0

Please sign in to comment.