The image creates SWW_STATE_DIR when it is missing (closes #337)
check / check (push) Waiting to run

Before waf starts, share/sww.run makes SWW_STATE_DIR if it is missing,
gives it to sww:sww and sets its mode to 0700. A setting that is not an
absolute path, or a SWW_STATE_DIR_FILE that cannot be read, still
changes nothing. script/example-app now checks that a waf container
whose SWW_STATE_DIR does not exist becomes healthy with the directory
made for sww, mode 0700.

Model: opus-5-5
This commit is contained in:
sneak committed 2026-11-11 10:01:50 +00:00
1 parent b93bad5842
commit 82adb13a0d
6 files changed
+40 -32

No files matched your search

+13 -5
View File
@@ -18,8 +18,8 @@
# client;
# - that a waf container with its state files on a new volume mounted at
# the directory SWW_STATE_DIR_FILE names becomes healthy;
# - that one whose SWW_STATE_DIR does not exist logs waf's message
# about it.
# - that the run script makes a SWW_STATE_DIR that does not exist, owned
# by sww with mode 0700, and that waf then becomes healthy.
# waf runs with SWW_LOOKUP_SOURCE=off, so that no address is sent to
# GeoJS. The containers, the network, the volumes and both images are removed
# however the script ends. Building the app needs network access, for nixpkgs'
@@ -159,6 +159,12 @@ owner_of() {
docker exec "$1" stat --format '%U' "$2"
}
# owner_and_mode_of <container> <dir>: print who owns dir there, and its
# mode in octal.
owner_and_mode_of() {
docker exec "$1" stat --format '%U %a' "$2"
}
main() {
cd "$ROOT"
trap cleanup EXIT
@@ -251,9 +257,11 @@ main() {
--env SWW_STATE_DIR=/srv/missing \
--env SWW_LOOKUP_SOURCE=off \
"$IMAGE" >/dev/null
wait_for "waf did not report the missing state directory" \
logged "$WAF" "SWW_STATE_DIR cannot be written"
echo "example-app: waf reports a state directory that does not exist"
wait_for "waf's health check did not pass" healthy "$WAF"
[ "$(owner_and_mode_of "$WAF" /srv/missing)" = "sww 700" ] ||
fail "the run script did not make SWW_STATE_DIR for sww with mode 0700"
echo "example-app: the run script makes a missing SWW_STATE_DIR for sww" \
"with mode 0700"
}
main "$@"