mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-05 09:18:53 +00:00
fix(web-app-joomla): finish the stock installer's cleanup on an NFS webroot
Docker Hub re-pushed joomla:6.2.0-php8.3-apache on 2026-11-19 with the docker-joomla entrypoint of official-images 82dbb58597. It skips setup for 'apache2 -v', so the wrapper's leader no longer installed anything. When the installer fails it keeps .joomla-initializing for good. On the swarm's NFS webroot the installer cannot delete installation/ ('[ERROR] Unable to delete installation folder!'), and every replica then exits with 'Initialization did not complete (exit 1); server startup is blocked.'
docker-entrypoint-joomla.sh now runs setup through the stock entrypoint with 'apache2 -l'. One leader runs it under a mkdir lock with a heartbeat owner file, and a lock whose heartbeat is older than JOOMLA_INIT_LOCK_STALE_SECONDS (180 s) is taken over atomically. When setup stops only at the delete message, the leader finishes what Joomla's CleanupModel does: it deletes installation/ and joomla.xml and renames robots.txt.dist. It records the pending cleanup in .infinito-init.cleanup, so a failed rm is retried on the next start. A site left stuck by the old wrapper fails with the exact manual step.
test_docker_entrypoint_joomla.py has 14 cases. It passes on the fix, fails 12 of 14 on the old wrapper, and fails on a mutant without the grep guard. Two independent skeptic rounds: the first refuted the earlier version, the second found no hole. Draft: no run against the real stock entrypoint on a real NFS volume yet; the fork CI swarm run proves it.
🎯 Fix: 85 %
💥 Break: 6 %
💸 Tokens: –
⏱️ Velocity: –
🛡️ Security: ~100 %
🏆 Score: 80
🚦 Gate: ⛔ fix 85 % < 90, break 6 % > 5
Created-with: https://s.veen.world/skills
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b50b7a45a4
commit
e8f788d2cb
7 files changed
+384
-25
No files matched your search
@@ -16,5 +16,6 @@ COPY ${JOOMLA_ENTRYPOINT_SCRIPT_HOST_REL} ${JOOMLA_ENTRYPOINT_SCRIPT_DOCKER}
|
||||
RUN chmod +x "${JOOMLA_ENTRYPOINT_SCRIPT_DOCKER}" \
|
||||
&& ln -sf "${JOOMLA_ENTRYPOINT_SCRIPT_DOCKER}" /usr/local/bin/entrypoint-joomla
|
||||
|
||||
ENV JOOMLA_STOCK_ENTRYPOINT=/entrypoint.sh
|
||||
ENTRYPOINT ["/usr/local/bin/entrypoint-joomla"]
|
||||
CMD ["apache2-foreground"]
|
||||
@@ -1,30 +1,130 @@
|
||||
#!/bin/bash
|
||||
# Serialize the stock image's first-boot copy+auto-install across replicas that
|
||||
# share the /var/www/html NFS volume (mkdir is atomic on NFS: one leader runs it,
|
||||
# the rest block on the ready marker). The setup only runs when $1 is apache2*/
|
||||
# php-fpm, so the leader must drive it with `apache2 -v` (returns after setup) —
|
||||
# a plain `true` skips the whole setup block and copies nothing.
|
||||
|
||||
target="/var/www/html"
|
||||
lock="${target}/.infinito-init.lock"
|
||||
webroot="${JOOMLA_WEBROOT:?JOOMLA_WEBROOT must be set}"
|
||||
stock="${JOOMLA_STOCK_ENTRYPOINT:?JOOMLA_STOCK_ENTRYPOINT must be set}"
|
||||
ready="${JOOMLA_INIT_READY_FILE:?JOOMLA_INIT_READY_FILE must be set}"
|
||||
stale_after="${JOOMLA_INIT_LOCK_STALE_SECONDS:?JOOMLA_INIT_LOCK_STALE_SECONDS must be set}"
|
||||
lock="${webroot}/.infinito-init.lock"
|
||||
owner="${lock}/owner"
|
||||
marker="${webroot}/.joomla-initializing"
|
||||
pending="${webroot}/.infinito-init.cleanup"
|
||||
config="${webroot}/configuration.php"
|
||||
token="${HOSTNAME}.$$.$(date +%s%N)"
|
||||
beat=$((stale_after / 4 + 1))
|
||||
heartbeat_pid=""
|
||||
|
||||
if [ ! -e "${ready}" ] && [ ! -e "${target}/configuration.php" ]; then
|
||||
if mkdir "${lock}" 2>/dev/null; then
|
||||
/entrypoint.sh apache2 -v || true # nocheck: shell-or-true -- grandfathered: worked in practice; TODO: sharpen to catch only the exact tolerated error
|
||||
if [ -e "${target}/configuration.php" ]; then
|
||||
chown -R www-data:www-data \
|
||||
"${target}/administrator/cache" "${target}/administrator/logs" \
|
||||
"${target}/cache" "${target}/tmp" 2>/dev/null || true # nocheck: shell-or-true -- grandfathered: worked in practice; TODO: sharpen to catch only the exact tolerated error
|
||||
touch "${ready}"
|
||||
fi
|
||||
else
|
||||
tries=0
|
||||
while [ ! -e "${ready}" ] && [ ! -e "${target}/configuration.php" ] && [ "${tries}" -lt 300 ]; do
|
||||
sleep 2
|
||||
tries=$((tries + 1))
|
||||
done
|
||||
trap 'exit 143' TERM
|
||||
trap 'exit 130' INT
|
||||
|
||||
log_error() {
|
||||
printf '[ERROR] %s\n' "$1" >&2
|
||||
}
|
||||
|
||||
initialized() {
|
||||
[ -e "${ready}" ] || { [ -s "${config}" ] && [ ! -e "${marker}" ]; }
|
||||
}
|
||||
|
||||
stale() {
|
||||
local stamp
|
||||
stamp="$(stat -c %Y "$1/owner" 2>/dev/null)" ||
|
||||
stamp="$(stat -c %Y "$1" 2>/dev/null)" ||
|
||||
return 1
|
||||
[ $(($(date +%s) - stamp)) -gt "${stale_after}" ]
|
||||
}
|
||||
|
||||
take_over_stale() {
|
||||
local moved="${lock}.stale.${token}"
|
||||
stale "${lock}" || return 1
|
||||
mv -T "${lock}" "${moved}" 2>/dev/null || return 1
|
||||
if stale "${moved}"; then
|
||||
rm -rf "${moved}"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
mv -T "${moved}" "${lock}"
|
||||
return 1
|
||||
}
|
||||
|
||||
exec /entrypoint.sh "$@"
|
||||
heartbeat() {
|
||||
while sleep "${beat}"; do
|
||||
touch "${owner}"
|
||||
done
|
||||
}
|
||||
|
||||
release() {
|
||||
if [ -n "${heartbeat_pid}" ]; then
|
||||
kill "${heartbeat_pid}" 2>/dev/null
|
||||
fi
|
||||
heartbeat_pid=""
|
||||
if [ "$(cat "${owner}" 2>/dev/null)" = "${token}" ]; then
|
||||
rm -rf "${lock}"
|
||||
fi
|
||||
}
|
||||
|
||||
run_setup() {
|
||||
local log
|
||||
log="$(mktemp)"
|
||||
# Exception: since docker-joomla 327d05a9f1 the stock entrypoint skips its
|
||||
# setup for -v/-V/-h/-t/-T; `apache2 -l` still runs it and then returns.
|
||||
{ "${stock}" apache2 -l 2>&1 | tee "${log}"; } &
|
||||
wait "$!"
|
||||
# Exception: Joomla's installer deletes installation/ while it still holds
|
||||
# installation/joomla.php open; NFS keeps that file as a .nfs silly rename,
|
||||
# so a complete install reports failure and the stock entrypoint keeps its
|
||||
# marker. The pending note lets any later start finish that cleanup.
|
||||
if [ -s "${config}" ] && [ -d "${marker}" ] &&
|
||||
grep -q 'Unable to delete installation folder' "${log}" &&
|
||||
! grep -qE 'Failed to (correct ownership|restore configuration)|Refusing to change permissions' "${log}"; then
|
||||
touch "${pending}"
|
||||
fi
|
||||
rm -f "${log}"
|
||||
}
|
||||
|
||||
finish_cleanup() {
|
||||
rm -rf "${webroot}/installation" || return 1
|
||||
rm -f "${webroot}/joomla.xml" || return 1
|
||||
if [ ! -e "${webroot}/robots.txt" ] && [ -e "${webroot}/robots.txt.dist" ]; then
|
||||
mv "${webroot}/robots.txt.dist" "${webroot}/robots.txt" || return 1
|
||||
fi
|
||||
rmdir "${marker}" || return 1
|
||||
rm -f "${pending}"
|
||||
}
|
||||
|
||||
recover() {
|
||||
if [ ! -e "${marker}" ]; then
|
||||
run_setup
|
||||
fi
|
||||
if [ -e "${marker}" ] && [ -e "${pending}" ] && ! finish_cleanup; then
|
||||
log_error "Finishing Joomla's installer cleanup in ${webroot} failed; ${pending} stays, so the next start retries it."
|
||||
return 1
|
||||
fi
|
||||
if initialized; then
|
||||
touch "${ready}"
|
||||
return 0
|
||||
fi
|
||||
if [ -e "${marker}" ]; then
|
||||
log_error "${marker} remains from an unfinished Joomla setup. If that setup stopped at 'Unable to delete installation folder!', run 'touch ${pending}' and restart; otherwise restore the site and database, then remove ${marker}."
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
lead() {
|
||||
local status
|
||||
printf '%s\n' "${token}" > "${owner}"
|
||||
trap release EXIT
|
||||
heartbeat &
|
||||
heartbeat_pid=$!
|
||||
recover
|
||||
status=$?
|
||||
release
|
||||
trap - EXIT
|
||||
return "${status}"
|
||||
}
|
||||
|
||||
until initialized; do
|
||||
if mkdir "${lock}" 2>/dev/null; then
|
||||
lead || exit 1
|
||||
elif ! take_over_stale; then
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
|
||||
exec "${stock}" "$@"
|
||||
@@ -1,6 +1,8 @@
|
||||
{% include 'roles/sys-svc-container/templates/env.j2' %}
|
||||
|
||||
JOOMLA_INIT_LOCK_STALE_SECONDS={{ JOOMLA_INIT_LOCK_STALE_SECONDS }}
|
||||
JOOMLA_INIT_READY_FILE={{ JOOMLA_INIT_READY_FILE }}
|
||||
JOOMLA_WEBROOT={{ JOOMLA_DOCROOT }}
|
||||
JOOMLA_SITE_NAME={{ JOOMLA_SITE_NAME }}
|
||||
JOOMLA_ADMIN_USER={{ JOOMLA_USER }}
|
||||
JOOMLA_ADMIN_USERNAME={{ JOOMLA_USER_NAME }}
|
||||
|
||||
@@ -13,6 +13,7 @@ JOOMLA_CONFIG_FILE: "/var/www/html/configuration.php"
|
||||
JOOMLA_INSTALLER_CLI_FILE: "/var/www/html/installation/joomla.php"
|
||||
JOOMLA_CLI_FILE: "/var/www/html/cli/joomla.php"
|
||||
JOOMLA_INIT_READY_FILE: "/var/www/html/.infinito-init.ready"
|
||||
JOOMLA_INIT_LOCK_STALE_SECONDS: 180
|
||||
JOOMLA_CLI_EXTENSION_ENABLE_SINCE: "6.1.0"
|
||||
|
||||
JOOMLA_DOCROOT: "{{ lookup('volume', application_id, 'data').target }}"
|
||||
|
||||
Whitespace-only changes.
Whitespace-only changes.
@@ -0,0 +1,255 @@
|
||||
import contextlib
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
from utils import PROJECT_ROOT
|
||||
|
||||
SHELL_DIR = PROJECT_ROOT / "roles/web-app-joomla/files/shell"
|
||||
ENTRYPOINT = SHELL_DIR / "docker-entrypoint-joomla.sh"
|
||||
SERVE = "serve apache2-foreground"
|
||||
|
||||
STOCK_STUB = """#!/usr/bin/env bash
|
||||
printf 'call %s\\n' "$*" >> "${STUB_CALLS}"
|
||||
case "$1" in apache2*) ;; *) exit 0 ;; esac
|
||||
case "${2-}" in -v | -V | -h | -t | -T) exit 0 ;; esac
|
||||
cd "${JOOMLA_WEBROOT}" || exit 9
|
||||
if [ -e .joomla-initializing ]; then
|
||||
echo '[ERROR] Initialization is incomplete or another initializer is active.' >&2
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -s configuration.php ]; then
|
||||
if [ "${STUB_DB}" != up ]; then
|
||||
echo '[ERROR] Database initialization failed (exit 1).' >&2
|
||||
exit 1
|
||||
fi
|
||||
mkdir .joomla-initializing
|
||||
printf 'init\\n' >> "${STUB_CALLS}"
|
||||
mkdir -p installation
|
||||
touch index.php installation/joomla.php joomla.xml robots.txt.dist
|
||||
sleep "${STUB_SETUP_DELAY}"
|
||||
if [ "${STUB_INSTALL}" = broken ]; then
|
||||
echo '[ERROR] Automatic Joomla installation failed (exit 1).' >&2
|
||||
exit 1
|
||||
fi
|
||||
echo '<?php' > configuration.php
|
||||
sleep "${STUB_FINISH_DELAY}"
|
||||
case "${STUB_INSTALL}" in
|
||||
crash)
|
||||
echo '[ERROR] Automatic Joomla installation failed (exit 255).' >&2
|
||||
exit 1 ;;
|
||||
nfs)
|
||||
echo ' [ERROR] Unable to delete installation folder!'
|
||||
exit 1 ;;
|
||||
nfs-unowned)
|
||||
echo ' [ERROR] Unable to delete installation folder!'
|
||||
echo '[ERROR] Failed to correct ownership after initialization.' >&2
|
||||
exit 1 ;;
|
||||
esac
|
||||
rm -rf installation joomla.xml
|
||||
mv robots.txt.dist robots.txt
|
||||
rmdir .joomla-initializing
|
||||
fi
|
||||
printf 'serve %s\\n' "$*" >> "${STUB_CALLS}"
|
||||
"""
|
||||
|
||||
RM_STUB = """#!/usr/bin/env bash
|
||||
if [ "${STUB_RM_FAIL}" = 1 ]; then
|
||||
case "$*" in *installation*) echo 'rm: Device or resource busy' >&2; exit 1 ;; esac
|
||||
fi
|
||||
PATH="${STUB_REAL_PATH}" exec rm "$@"
|
||||
"""
|
||||
|
||||
|
||||
class TestJoomlaEntrypoint(unittest.TestCase):
|
||||
def setUp(self):
|
||||
tmp = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(tmp.cleanup)
|
||||
self.root = Path(tmp.name)
|
||||
self.webroot = self.root / "html"
|
||||
self.webroot.mkdir()
|
||||
bin_dir = self.root / "bin"
|
||||
bin_dir.mkdir()
|
||||
self.stock = self.root / "entrypoint.sh"
|
||||
for path, body in {self.stock: STOCK_STUB, bin_dir / "rm": RM_STUB}.items():
|
||||
path.write_text(body)
|
||||
path.chmod(0o755)
|
||||
self.ready = self.webroot / ".infinito-init.ready"
|
||||
self.marker = self.webroot / ".joomla-initializing"
|
||||
self.lock = self.webroot / ".infinito-init.lock"
|
||||
self.pending = self.webroot / ".infinito-init.cleanup"
|
||||
self.env = {
|
||||
**os.environ,
|
||||
"PATH": f"{bin_dir}{os.pathsep}{os.environ['PATH']}",
|
||||
"STUB_REAL_PATH": os.environ["PATH"],
|
||||
"JOOMLA_WEBROOT": str(self.webroot),
|
||||
"JOOMLA_STOCK_ENTRYPOINT": str(self.stock),
|
||||
"JOOMLA_INIT_READY_FILE": str(self.ready),
|
||||
"JOOMLA_INIT_LOCK_STALE_SECONDS": "60",
|
||||
"STUB_DB": "up",
|
||||
"STUB_INSTALL": "ok",
|
||||
"STUB_SETUP_DELAY": "0",
|
||||
"STUB_FINISH_DELAY": "0",
|
||||
"STUB_RM_FAIL": "0",
|
||||
}
|
||||
|
||||
def spawn(self, name="calls", **env):
|
||||
log = self.root / f"{name}.log"
|
||||
log.touch()
|
||||
with (self.root / f"{name}.err").open("a") as err:
|
||||
process = subprocess.Popen(
|
||||
["bash", str(ENTRYPOINT), "apache2-foreground"],
|
||||
env={**self.env, "STUB_CALLS": str(log), **env},
|
||||
stdout=subprocess.DEVNULL,
|
||||
stderr=err,
|
||||
start_new_session=True,
|
||||
)
|
||||
self.addCleanup(self.kill_group, process)
|
||||
return process
|
||||
|
||||
def kill_group(self, process):
|
||||
with contextlib.suppress(ProcessLookupError, PermissionError):
|
||||
os.killpg(process.pid, signal.SIGKILL)
|
||||
process.wait()
|
||||
|
||||
def run_entrypoint(self, **env):
|
||||
return self.spawn(**env).wait(timeout=60)
|
||||
|
||||
def text(self, name):
|
||||
path = self.root / name
|
||||
return path.read_text(encoding="utf-8") # nocheck: cache-read tempdir
|
||||
|
||||
def calls(self, name="calls"):
|
||||
return self.text(f"{name}.log").splitlines()
|
||||
|
||||
def wait_for(self, path):
|
||||
deadline = time.monotonic() + 30
|
||||
while not path.exists() and time.monotonic() < deadline:
|
||||
time.sleep(0.1)
|
||||
self.assertTrue(path.exists())
|
||||
|
||||
def leave_stuck_volume(self):
|
||||
for name in ("installation", ".joomla-initializing", ".infinito-init.lock"):
|
||||
(self.webroot / name).mkdir()
|
||||
(self.webroot / "configuration.php").write_text("<?php\n")
|
||||
(self.webroot / "robots.txt.dist").write_text("User-agent: *\n")
|
||||
hour_ago = time.time() - 3600
|
||||
os.utime(self.lock, (hour_ago, hour_ago))
|
||||
|
||||
def assert_site_down(self):
|
||||
self.assertTrue(self.marker.is_dir())
|
||||
self.assertFalse(self.ready.exists())
|
||||
self.assertNotIn(SERVE, self.calls())
|
||||
|
||||
def test_a_fresh_volume_is_set_up_once_before_the_server_starts(self):
|
||||
self.assertEqual(self.run_entrypoint(), 0)
|
||||
self.assertEqual(self.calls().count("init"), 1)
|
||||
self.assertEqual(self.calls()[-1], SERVE)
|
||||
self.assertTrue(self.ready.exists())
|
||||
self.assertFalse(self.lock.exists())
|
||||
|
||||
def test_the_nfs_installation_folder_failure_finishes_the_cleanup(self):
|
||||
self.assertEqual(self.run_entrypoint(STUB_INSTALL="nfs"), 0)
|
||||
for name in ("installation", "joomla.xml", "robots.txt.dist"):
|
||||
self.assertFalse((self.webroot / name).exists(), name)
|
||||
self.assertTrue((self.webroot / "robots.txt").is_file())
|
||||
self.assertFalse(self.marker.exists())
|
||||
self.assertFalse(self.pending.exists())
|
||||
self.assertEqual(self.calls()[-1], SERVE)
|
||||
|
||||
def test_an_install_crash_after_the_config_was_written_keeps_the_site_down(self):
|
||||
self.assertNotEqual(self.run_entrypoint(STUB_INSTALL="crash"), 0)
|
||||
self.assert_site_down()
|
||||
self.assertTrue((self.webroot / "installation").is_dir())
|
||||
self.assertFalse(self.pending.exists())
|
||||
self.assertFalse(self.lock.exists())
|
||||
|
||||
def test_a_failed_ownership_repair_keeps_the_site_down(self):
|
||||
self.assertNotEqual(self.run_entrypoint(STUB_INSTALL="nfs-unowned"), 0)
|
||||
self.assert_site_down()
|
||||
self.assertFalse(self.pending.exists())
|
||||
|
||||
def test_a_failed_install_keeps_the_server_down_and_releases_the_lock(self):
|
||||
self.assertNotEqual(self.run_entrypoint(STUB_INSTALL="broken"), 0)
|
||||
self.assert_site_down()
|
||||
self.assertFalse(self.lock.exists())
|
||||
|
||||
def test_a_restart_after_a_database_outage_sets_the_site_up(self):
|
||||
self.assertNotEqual(self.run_entrypoint(STUB_DB="down"), 0)
|
||||
self.assertEqual(self.run_entrypoint(), 0)
|
||||
self.assertEqual(self.calls().count("init"), 1)
|
||||
self.assertEqual(self.calls()[-1], SERVE)
|
||||
|
||||
def test_an_existing_installation_starts_without_setup(self):
|
||||
(self.webroot / "configuration.php").write_text("<?php\n")
|
||||
self.assertEqual(self.run_entrypoint(), 0)
|
||||
self.assertNotIn("init", self.calls())
|
||||
self.assertEqual(self.calls()[-1], SERVE)
|
||||
|
||||
def test_a_follower_starts_only_after_the_leader_finished(self):
|
||||
leader = self.spawn("leader", STUB_FINISH_DELAY="3")
|
||||
self.wait_for(self.lock)
|
||||
follower = self.spawn("follower")
|
||||
self.assertEqual(leader.wait(timeout=60), 0)
|
||||
self.assertEqual(follower.wait(timeout=60), 0)
|
||||
self.assertEqual(self.calls("follower"), ["call apache2-foreground", SERVE])
|
||||
|
||||
def test_a_live_leader_keeps_its_lock_past_the_stale_age(self):
|
||||
stale = {"JOOMLA_INIT_LOCK_STALE_SECONDS": "3"}
|
||||
leader = self.spawn("leader", STUB_SETUP_DELAY="8", **stale)
|
||||
self.wait_for(self.lock / "owner")
|
||||
follower = self.spawn("follower", **stale)
|
||||
self.assertEqual(leader.wait(timeout=60), 0)
|
||||
self.assertEqual(follower.wait(timeout=60), 0)
|
||||
self.assertEqual(self.calls("leader").count("init"), 1)
|
||||
self.assertEqual(self.calls("follower"), ["call apache2-foreground", SERVE])
|
||||
|
||||
def test_a_stale_lock_on_a_fresh_volume_is_taken_over(self):
|
||||
self.lock.mkdir()
|
||||
hour_ago = time.time() - 3600
|
||||
os.utime(self.lock, (hour_ago, hour_ago))
|
||||
self.assertEqual(self.run_entrypoint(), 0)
|
||||
self.assertEqual(self.calls().count("init"), 1)
|
||||
self.assertEqual(self.calls()[-1], SERVE)
|
||||
|
||||
def test_a_stuck_volume_names_the_manual_step_instead_of_starting(self):
|
||||
self.leave_stuck_volume()
|
||||
self.assertNotEqual(self.run_entrypoint(), 0)
|
||||
self.assert_site_down()
|
||||
self.assertIn(f"touch {self.pending}", self.text("calls.err"))
|
||||
self.assertFalse(self.lock.exists())
|
||||
|
||||
def test_a_stuck_volume_recovers_once_the_manual_step_is_done(self):
|
||||
self.leave_stuck_volume()
|
||||
self.pending.touch()
|
||||
self.assertEqual(self.run_entrypoint(), 0)
|
||||
self.assertFalse((self.webroot / "installation").exists())
|
||||
self.assertTrue((self.webroot / "robots.txt").is_file())
|
||||
self.assertFalse(self.marker.exists())
|
||||
self.assertEqual(self.calls()[-1], SERVE)
|
||||
|
||||
def test_a_failed_folder_removal_is_retried_on_the_next_start(self):
|
||||
failed = self.run_entrypoint(STUB_INSTALL="nfs", STUB_RM_FAIL="1")
|
||||
self.assertNotEqual(failed, 0)
|
||||
self.assert_site_down()
|
||||
self.assertTrue(self.pending.exists())
|
||||
self.assertEqual(self.run_entrypoint(), 0)
|
||||
self.assertFalse((self.webroot / "installation").exists())
|
||||
self.assertFalse(self.marker.exists())
|
||||
self.assertEqual(self.calls().count("init"), 1)
|
||||
self.assertEqual(self.calls()[-1], SERVE)
|
||||
|
||||
def test_sigterm_during_setup_releases_the_lock(self):
|
||||
leader = self.spawn(STUB_SETUP_DELAY="10")
|
||||
self.wait_for(self.lock / "owner")
|
||||
leader.send_signal(signal.SIGTERM)
|
||||
self.assertEqual(leader.wait(timeout=30), 143)
|
||||
self.assertFalse(self.lock.exists())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user