srt is pinned to 0.0.83, the version the smoketest passed with. A computer with another version sees the agents item as to do in configure, which installs the pinned one. Move the pin only after smoketest/run 50 80 passes. The installer and configure stop on Pop!_OS (or Ubuntu) older than 26.04. The smoketest builds on Ubuntu 26.04, with checks that 24.04 is refused. 26.04's own AppArmor profile lets bubblewrap make user namespaces, so the connector's profile for it, and the code that offered to add it, are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
112 lines
3.3 KiB
Bash
Executable File
112 lines
3.3 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Purpose : Run the smoketest scenarios, each in a fresh Ubuntu 26.04
|
|
# container (Pop!_OS 26.04's base) with Docker. See README.md.
|
|
#
|
|
# Usage: smoketest/run [--tier quick|all] [--keep] [scenario...]
|
|
# smoketest/run --list
|
|
|
|
# Wrapped in { ...; exit; } so bash reads the whole script up front
|
|
{
|
|
|
|
SMOKETEST="$(cd "$(dirname "$0")" && pwd)"
|
|
REPO="$(dirname "$SMOKETEST")"
|
|
IMAGE="federated-connector-popos-smoketest"
|
|
TIER=quick
|
|
KEEP=0
|
|
SCENARIOS=()
|
|
|
|
usage() {
|
|
cat << EOF
|
|
Usage: smoketest/run [options] [scenario...]
|
|
|
|
--tier quick|all quick leaves out the slow scenarios (default: quick)
|
|
--keep Leave each container afterwards, to look around in it
|
|
--list List the scenarios and their tier
|
|
|
|
Scenarios are named by file name or number, e.g. 40-backup or 40.
|
|
EOF
|
|
}
|
|
|
|
scenario_var() {
|
|
sed -nE "s/^$2=\"?([^\"]*)\"?.*/\\1/p" "$1" | head -n 1
|
|
}
|
|
|
|
list() {
|
|
local file
|
|
for file in "$SMOKETEST"/scenarios/*.sh; do
|
|
printf '%-20s %-6s %s\n' "$(basename "$file" .sh)" "$(scenario_var "$file" TIER)" \
|
|
"$(scenario_var "$file" DESCRIPTION)"
|
|
done
|
|
}
|
|
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
--tier) TIER="$2"; shift 2 ;;
|
|
--keep) KEEP=1; shift ;;
|
|
--list) list; exit 0 ;;
|
|
-h|--help) usage; exit 0 ;;
|
|
-*) usage; exit 2 ;;
|
|
*) SCENARIOS+=("$1"); shift ;;
|
|
esac
|
|
done
|
|
|
|
command -v docker > /dev/null || { echo "Docker isn't installed."; exit 1; }
|
|
|
|
# The scenario files to run
|
|
pick() {
|
|
local file name want
|
|
for file in "$SMOKETEST"/scenarios/*.sh; do
|
|
name="$(basename "$file" .sh)"
|
|
if [ ${#SCENARIOS[@]} -eq 0 ]; then
|
|
[ "$TIER" = all ] || [ "$(scenario_var "$file" TIER)" = quick ] || continue
|
|
echo "$file"
|
|
else
|
|
for want in "${SCENARIOS[@]}"; do
|
|
case "$name" in "$want"|"$want"-*) echo "$file" ;; esac
|
|
done
|
|
fi
|
|
done
|
|
}
|
|
|
|
mapfile -t FILES < <(pick)
|
|
if [ ${#FILES[@]} -eq 0 ]; then
|
|
echo "No scenarios to run. smoketest/run --list shows them."
|
|
exit 2
|
|
fi
|
|
|
|
echo "Building the image..."
|
|
docker build -q -t "$IMAGE" "$SMOKETEST" > /dev/null || exit 1
|
|
|
|
RESULTS="$SMOKETEST/results/$(date +%Y%m%d-%H%M%S)"
|
|
mkdir -p "$RESULTS"
|
|
PASSED=() FAILED=()
|
|
|
|
for file in "${FILES[@]}"; do
|
|
scenario="$(basename "$file" .sh)"
|
|
log="$RESULTS/$scenario.log"
|
|
echo
|
|
echo "== $scenario: $(scenario_var "$file" DESCRIPTION)"
|
|
# The sandbox needs to make user namespaces, which Docker's defaults forbid
|
|
extra=()
|
|
[ "$(scenario_var "$file" PRIVILEGED)" = 1 ] && extra=(--privileged)
|
|
rm_flag=(--rm)
|
|
[ $KEEP -eq 1 ] && rm_flag=(--name "fc-smoke-$scenario-$$")
|
|
# The working copy, as it is now, read-only at /src and copied to ~/connector
|
|
docker run "${rm_flag[@]}" "${extra[@]}" -v "$REPO:/src:ro" "$IMAGE" bash -c '
|
|
mkdir ~/connector && tar -C /src --exclude ./.git --exclude .claude --exclude ./smoketest/results -cf - . \
|
|
| tar -xf - -C ~/connector && bash ~/connector/smoketest/lib/runner.sh ~/connector/smoketest/scenarios/'"$scenario"'.sh' \
|
|
2>&1 | tee "$log"
|
|
status=${PIPESTATUS[0]}
|
|
[ $KEEP -eq 1 ] && echo " Kept the container: docker start -ai fc-smoke-$scenario-$$ (docker rm it afterwards)"
|
|
if [ "$status" -eq 0 ]; then PASSED+=("$scenario"); else FAILED+=("$scenario"); fi
|
|
done
|
|
|
|
echo
|
|
echo "Passed: ${PASSED[*]:-none}"
|
|
echo "Failed: ${FAILED[*]:-none}"
|
|
echo "Logs: $RESULTS"
|
|
[ ${#FAILED[@]} -eq 0 ]
|
|
exit
|
|
}
|