Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7a642b23c |
+2
-21
@@ -4,7 +4,6 @@ The command runner must be supplied by the caller.
|
||||
This module does not execute subprocesses directly.
|
||||
"""
|
||||
|
||||
import json
|
||||
import os
|
||||
import stat
|
||||
import tempfile
|
||||
@@ -38,7 +37,6 @@ class ServiceLifecycle:
|
||||
stop_timeout=90,
|
||||
*,
|
||||
site_secrets=None,
|
||||
topology_runner=None,
|
||||
):
|
||||
|
||||
require(
|
||||
@@ -88,8 +86,6 @@ class ServiceLifecycle:
|
||||
self._queue = docker["queue_service"]
|
||||
self._scheduler = docker["scheduler_service"]
|
||||
|
||||
self._backend_network = docker["backend_network"]
|
||||
self._topology_runner = topology_runner
|
||||
self._runner = runner
|
||||
self._stop_timeout = stop_timeout
|
||||
|
||||
@@ -118,18 +114,6 @@ class ServiceLifecycle:
|
||||
f"Service operation failed: {operation}",
|
||||
)
|
||||
|
||||
def _require_project_backend(self):
|
||||
require(callable(self._topology_runner), "Trusted Compose topology runner required")
|
||||
command = (*self._prefix, "config", "--format", "json")
|
||||
try:
|
||||
model = json.loads(self._topology_runner(command, timeout=30))
|
||||
backend = model["networks"][self._backend_network]
|
||||
except Exception:
|
||||
raise ServiceError("Unable to verify Compose backend network") from None
|
||||
require(isinstance(backend, dict), "Invalid Compose backend network")
|
||||
require(backend.get("external", False) is False,
|
||||
"External Compose backend networks are prohibited")
|
||||
|
||||
def quiesce(self):
|
||||
|
||||
self._execute(
|
||||
@@ -146,7 +130,6 @@ class ServiceLifecycle:
|
||||
|
||||
def restart_php(self):
|
||||
|
||||
self._require_project_backend()
|
||||
self._execute(
|
||||
"restart PHP",
|
||||
(
|
||||
@@ -198,7 +181,6 @@ class ServiceLifecycle:
|
||||
|
||||
def resume(self):
|
||||
|
||||
self._require_project_backend()
|
||||
self._execute(
|
||||
"resume workers",
|
||||
(
|
||||
@@ -221,9 +203,8 @@ class ContainedServiceLifecycle(ServiceLifecycle):
|
||||
"""
|
||||
|
||||
def __init__(self, config, runner, *, gate_directory, ingress_sealed,
|
||||
worker_running, stop_timeout=90, site_secrets=None, topology_runner=None):
|
||||
super().__init__(config, runner, stop_timeout, site_secrets=site_secrets,
|
||||
topology_runner=topology_runner)
|
||||
worker_running, stop_timeout=90, site_secrets=None):
|
||||
super().__init__(config, runner, stop_timeout, site_secrets=site_secrets)
|
||||
require(callable(ingress_sealed) and callable(worker_running),
|
||||
"Containment probes are required")
|
||||
self._gate_directory = Path(gate_directory)
|
||||
|
||||
@@ -34,11 +34,3 @@ result record the activation and health outcome independently of reopening.
|
||||
|
||||
These controls are available to the trusted runtime composition. The
|
||||
operational production CLI remains disabled.
|
||||
|
||||
Pass a trusted `topology_runner(command, *, timeout)` that returns stdout
|
||||
from a successful Compose command as JSON bytes or text and raises on failure.
|
||||
The runtime resolves the exact project and Compose files with
|
||||
`config --format json` before starting workers or restarting PHP. Missing,
|
||||
unverifiable, or external configured backend networks deny those operations.
|
||||
Keep Compose inputs under trusted control across validation and execution.
|
||||
Stopping workers remains available if topology validation fails.
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
934a04b5d6ec9aa62cb991fb2f57256c439bac4b2ac110cabd524ad456e59491 ./capabilities-after.json
|
||||
934a04b5d6ec9aa62cb991fb2f57256c439bac4b2ac110cabd524ad456e59491 ./capabilities-before.json
|
||||
cc4a6894db5d31b57a686cf8d23b86e1710388b9562df3f4b152fe03b9e1abf6 ./checks.jsonl
|
||||
c692d9943cdf76339c82f6d77bf3e24d8f3b77ba70b8203e687e8104b9b351a1 ./framework-ci.txt
|
||||
c25354dc469de95845d96f00548f745c62cd510e46cdf94ddcdaf139f918b5df ./scope.txt
|
||||
ed2e7da48d89da2c217f5ada21465e98ed08f48d51915105fff5d5b9746f6033 run.sh
|
||||
9d6b8cbf1b02abb9effee48d56dc136b5cb057f19fef33747fa23f299d51064b probe.py
|
||||
@@ -1,4 +0,0 @@
|
||||
{"check": "each site used a distinct project-owned internal network with no published ports", "result": "PASS"}
|
||||
{"check": "local service DNS worked and cross-project service DNS failed in both directions", "result": "PASS"}
|
||||
{"check": "external backend rejected before worker start or PHP restart; no service command ran", "result": "PASS"}
|
||||
{"check": "disposable Compose projects and networks removed", "result": "PASS"}
|
||||
@@ -1,98 +0,0 @@
|
||||
import copy
|
||||
import json
|
||||
import secrets
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from core.services import ServiceError, ServiceLifecycle
|
||||
|
||||
base = json.loads(Path("config/site.example.json").read_text())
|
||||
image_id = "sha256:e742a2668255221388004f3a42b6150a2103f5054ab3a4a93ae9e4f01e551c35"
|
||||
run = secrets.token_hex(5)
|
||||
projects = []
|
||||
|
||||
def cmd(*args):
|
||||
return subprocess.check_output(args, timeout=60, text=True).strip()
|
||||
|
||||
def record(check):
|
||||
print(json.dumps({"check": check, "result": "PASS"}), flush=True)
|
||||
|
||||
def setup(label, external=None):
|
||||
name = f"absdev-topology-{label}-{run}"
|
||||
root = Path.cwd().parent / label
|
||||
root.mkdir()
|
||||
config = copy.deepcopy(base)
|
||||
config["site"].update(identifier=name, root=str(root))
|
||||
config["docker"].update(project=name, backend_network="backend")
|
||||
image = json.loads(cmd("docker", "image", "inspect", image_id))[0]
|
||||
tag = next(t for t in image["RepoTags"] if t.startswith("postgres:"))
|
||||
assert json.loads(cmd("docker", "image", "inspect", tag))[0]["Id"] == image_id
|
||||
topology = {
|
||||
"services": {
|
||||
svc: {"image": tag, "pull_policy": "never", "entrypoint": ["sleep", "300"],
|
||||
"user": "10001:10001", "read_only": True, "cap_drop": ["ALL"],
|
||||
"security_opt": ["no-new-privileges:true"],
|
||||
"networks": {"backend": {"aliases": [name + "-" + svc]}}}
|
||||
for svc in ("queue", "scheduler")
|
||||
},
|
||||
"networks": {"backend": ({"external": True, "name": external} if external
|
||||
else {"internal": True})},
|
||||
}
|
||||
spec = root / "compose.yaml"
|
||||
spec.write_text(json.dumps(topology))
|
||||
prefix = ("docker", "compose", "--project-name", name, "--project-directory", str(root),
|
||||
"--file", str(spec))
|
||||
actions = []
|
||||
def runner(argv, *, timeout):
|
||||
assert argv[:len(prefix)] == prefix
|
||||
actions.append(argv[len(prefix)])
|
||||
return subprocess.run(argv, timeout=timeout, stdout=subprocess.DEVNULL,
|
||||
stderr=subprocess.DEVNULL).returncode
|
||||
def topology_runner(argv, *, timeout):
|
||||
assert argv == (*prefix, "config", "--format", "json")
|
||||
return subprocess.check_output(argv, timeout=timeout)
|
||||
lifecycle = ServiceLifecycle(config, runner, topology_runner=topology_runner)
|
||||
if external:
|
||||
resolved = json.loads(topology_runner((*prefix, "config", "--format", "json"), timeout=30))
|
||||
assert resolved["networks"]["backend"]["external"] is True
|
||||
for operation in (lifecycle.resume, lifecycle.restart_php):
|
||||
try:
|
||||
operation()
|
||||
except ServiceError as error:
|
||||
assert "External Compose backend networks" in str(error)
|
||||
else:
|
||||
raise AssertionError("External backend accepted")
|
||||
assert not actions
|
||||
assert not cmd("docker", "ps", "-aq", "--filter", "label=com.docker.compose.project=" + name)
|
||||
return None
|
||||
projects.append(prefix)
|
||||
lifecycle.resume()
|
||||
ids = [cmd(*prefix, "ps", "-q", svc) for svc in ("queue", "scheduler")]
|
||||
network = name + "_backend"
|
||||
details = json.loads(cmd("docker", "network", "inspect", network))[0]
|
||||
assert details["Internal"] and details["Labels"]["com.docker.compose.project"] == name
|
||||
for cid in ids:
|
||||
info = json.loads(cmd("docker", "inspect", cid))[0]
|
||||
assert set(info["NetworkSettings"]["Networks"]) == {network}
|
||||
assert not info["HostConfig"]["PortBindings"] and not info["HostConfig"]["Privileged"]
|
||||
return name, network, ids[0]
|
||||
|
||||
def lookup(cid, host):
|
||||
return subprocess.run(("docker", "exec", cid, "getent", "hosts", host),
|
||||
capture_output=True, timeout=15)
|
||||
|
||||
try:
|
||||
a, anet, ac = setup("alpha")
|
||||
b, bnet, bc = setup("beta")
|
||||
assert anet != bnet
|
||||
record("each site used a distinct project-owned internal network with no published ports")
|
||||
for name, other, cid in ((a, b, ac), (b, a, bc)):
|
||||
assert lookup(cid, name + "-scheduler").returncode == 0
|
||||
denied = lookup(cid, other + "-scheduler")
|
||||
assert denied.returncode == 2 and not denied.stdout
|
||||
record("local service DNS worked and cross-project service DNS failed in both directions")
|
||||
setup("shared-model", external=anet)
|
||||
record("external backend rejected before worker start or PHP restart; no service command ran")
|
||||
finally:
|
||||
for prefix in reversed(projects):
|
||||
cmd(*prefix, "down", "--volumes", "--timeout", "1")
|
||||
record("disposable Compose projects and networks removed")
|
||||
@@ -1,22 +0,0 @@
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
test "$(hostname -s | tr A-Z a-z)" = absdev-ci
|
||||
stage=$(mktemp -d /var/tmp/absdev-backend-network.XXXXXX)
|
||||
trap 'rm -rf -- "$stage"' EXIT
|
||||
mkdir "$stage/source" "$stage/evidence" "$stage/tmp"
|
||||
tar -xm -f - -C "$stage/source"
|
||||
cd "$stage/source"
|
||||
export TMPDIR="$stage/tmp"
|
||||
export DOCKER_CONFIG=/var/tmp/absdev-supported-containment.L6qYEi/docker-config
|
||||
out="$stage/evidence"
|
||||
printf 'host=%s\nrevision=89418ea21ad3d307eff3cbadc978687a48e572ce\n' "$(hostname -s)" > "$out/scope.txt"
|
||||
docker compose version >> "$out/scope.txt"
|
||||
sha256sum "$DOCKER_CONFIG/cli-plugins/docker-compose" >> "$out/scope.txt"
|
||||
python3 -B bin/absdev-deploy capabilities > "$out/capabilities-before.json"
|
||||
python3 -B -c 'import json,sys; d=json.load(open(sys.argv[1])); f=[v for k,v in d.items() if k.endswith("_enabled") or k=="production_ready"]; assert len(f)==6 and all(v is False for v in f)' "$out/capabilities-before.json"
|
||||
python3 -B probe.py > "$out/checks.jsonl" || { cat "$out/checks.jsonl" >&2; exit 1; }
|
||||
bash scripts/ci-check.sh > "$out/framework-ci.txt" 2>&1 || { tail -80 "$out/framework-ci.txt" >&2; exit 1; }
|
||||
python3 -B bin/absdev-deploy capabilities > "$out/capabilities-after.json"
|
||||
cmp "$out/capabilities-before.json" "$out/capabilities-after.json"
|
||||
(cd "$out" && sha256sum ./* > SHA256SUMS)
|
||||
tar -czf - -C "$out" .
|
||||
@@ -1,4 +0,0 @@
|
||||
host=absdev-ci
|
||||
revision=89418ea21ad3d307eff3cbadc978687a48e572ce
|
||||
Docker Compose version 2.40.3+ds1-0ubuntu1
|
||||
93226cc2ea191353641921350ad87d96cb942e29a21c7c68c430adfd9954af34 /var/tmp/absdev-supported-containment.L6qYEi/docker-config/cli-plugins/docker-compose
|
||||
@@ -0,0 +1,8 @@
|
||||
934a04b5d6ec9aa62cb991fb2f57256c439bac4b2ac110cabd524ad456e59491 ./capabilities-after.json
|
||||
934a04b5d6ec9aa62cb991fb2f57256c439bac4b2ac110cabd524ad456e59491 ./capabilities-before.json
|
||||
b2d5eb9eb65eae107efd1e7afdebef051e24f85e71ed9a556c35721a1df911d7 ./checks.jsonl
|
||||
563b698c0d99294765669c84c96869f92dcae9f87df8f8e62de69dc8fa946d83 ./framework-ci.txt
|
||||
eebbff2c0505a4e3e80a676500191b4d9b41fb8a18a39a235cc717d36aeb81ab ./scope.txt
|
||||
8c89cb04d6f12405a9e0fcd5e0d3519d7511329699c0f27eeecd4df0f537a27e controller.py
|
||||
afda0afc490c108f7e1ce1a1774185fe566e7d38f43918a426e11144425ce6e6 worker.py
|
||||
3cea8a8d312caf532497e79d2d8aaa9dd29acf1008342be9862eefc8ea7efdb6 run.sh
|
||||
@@ -0,0 +1,7 @@
|
||||
{"check": "authorised approval consumed once and replay rejected", "result": "PASS"}
|
||||
{"check": "same running process rejected unconsumed approval after execute grant removal", "result": "PASS"}
|
||||
{"check": "same running process rejected an approval sealed by the retired key", "result": "PASS"}
|
||||
{"check": "missing authority failed closed without a consumption marker", "result": "PASS"}
|
||||
{"check": "unsafe authority permissions failed closed without a consumption marker", "result": "PASS"}
|
||||
{"check": "replacement key restored authorised consumption in the original process", "result": "PASS"}
|
||||
{"check":"disposable operator and authority files removed","result":"PASS"}
|
||||
@@ -0,0 +1,62 @@
|
||||
import json
|
||||
import os
|
||||
import secrets
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
|
||||
account, uid, gid, root = sys.argv[1:]
|
||||
uid, gid, root = int(uid), int(gid), Path(root)
|
||||
path = root / "authority.json"
|
||||
key = secrets.token_hex(32)
|
||||
|
||||
def publish(actions, signing_key):
|
||||
grants = [dict(uid=uid, principal="operator", operation=op, site="example-absdev-net",
|
||||
revision="a"*40, expires_at="2026-12-01T10:00:00+00:00") for op in actions]
|
||||
with tempfile.NamedTemporaryFile(mode="w", dir=root, delete=False) as stream:
|
||||
json.dump({"grants": grants, "sealing_key": signing_key}, stream)
|
||||
stream.flush()
|
||||
os.fchown(stream.fileno(), 0, gid)
|
||||
os.fchmod(stream.fileno(), 0o440)
|
||||
os.fsync(stream.fileno())
|
||||
os.replace(stream.name, path)
|
||||
|
||||
def report(check):
|
||||
print(json.dumps({"check": check, "result": "PASS"}), flush=True)
|
||||
|
||||
publish(("issue", "execute"), key)
|
||||
with subprocess.Popen(("runuser", "-u", account, "--", "env", "TMPDIR=" + str(root.parent / "operator-tmp"), "python3", "-B", "worker.py", str(path)),
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True) as process:
|
||||
def send(action, expected):
|
||||
process.stdin.write(action + "\n")
|
||||
process.stdin.flush()
|
||||
assert process.stdout.readline().strip() == expected, action
|
||||
|
||||
send("issue", "issued")
|
||||
send("consume", "consumed")
|
||||
send("replay", "rejected")
|
||||
report("authorised approval consumed once and replay rejected")
|
||||
send("issue", "issued")
|
||||
publish(("issue",), key)
|
||||
send("reject", "rejected")
|
||||
report("same running process rejected unconsumed approval after execute grant removal")
|
||||
publish(("issue", "execute"), key)
|
||||
rotated = secrets.token_hex(32)
|
||||
publish(("issue", "execute"), rotated)
|
||||
send("reject", "rejected")
|
||||
report("same running process rejected an approval sealed by the retired key")
|
||||
send("issue", "issued")
|
||||
path.unlink()
|
||||
send("reject", "rejected")
|
||||
report("missing authority failed closed without a consumption marker")
|
||||
publish(("issue", "execute"), rotated)
|
||||
path.chmod(0o444)
|
||||
send("reject", "rejected")
|
||||
report("unsafe authority permissions failed closed without a consumption marker")
|
||||
publish(("issue", "execute"), rotated)
|
||||
send("consume", "consumed")
|
||||
send("replay", "rejected")
|
||||
report("replacement key restored authorised consumption in the original process")
|
||||
process.stdin.close()
|
||||
assert process.wait(timeout=10) == 0
|
||||
+2
-2
@@ -5,9 +5,9 @@ Python 3.14.4
|
||||
PASS: 88 Python sources compiled
|
||||
|
||||
=== COMPLETE UNIT REGRESSION SUITE ===
|
||||
.......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
|
||||
.....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
|
||||
----------------------------------------------------------------------
|
||||
Ran 903 tests in 17.975s
|
||||
Ran 901 tests in 18.524s
|
||||
|
||||
OK
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
test "$(hostname -s | tr A-Z a-z)" = absdev-ci
|
||||
stage=$(mktemp -d /var/tmp/absdev-revocation-fix.XXXXXX)
|
||||
suffix=$(tr '[:upper:]' '[:lower:]' <<< "${stage##*.}")
|
||||
account="abrev$suffix"
|
||||
created=0
|
||||
cleanup() {
|
||||
rc=$?
|
||||
if ((created)); then userdel "$account" || rc=1; fi
|
||||
rm -rf -- "$stage" || rc=1
|
||||
exit "$rc"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
mkdir "$stage/source" "$stage/evidence" "$stage/tmp"
|
||||
tar -xm -f - -C "$stage/source"
|
||||
chmod 0711 "$stage"
|
||||
chmod -R a+rX "$stage/source"
|
||||
useradd -U -M -d /nonexistent -s /usr/sbin/nologin "$account"
|
||||
created=1
|
||||
install -d -m 0750 -o root -g "$account" "$stage/authority"
|
||||
install -d -m 0700 -o "$account" -g "$account" "$stage/operator-tmp"
|
||||
export TMPDIR="$stage/tmp"
|
||||
out="$stage/evidence"
|
||||
cd "$stage/source"
|
||||
printf 'host=%s\nrevision=2719378f67da153f0210b886d66e8e2b68cf6c01\noperator_uid=%s\n' "$(hostname -s)" "$(id -u "$account")" > "$out/scope.txt"
|
||||
python3 -B bin/absdev-deploy capabilities > "$out/capabilities-before.json"
|
||||
python3 -B controller.py "$account" "$(id -u "$account")" "$(id -g "$account")" "$stage/authority" > "$out/checks.jsonl"
|
||||
userdel "$account"
|
||||
created=0
|
||||
rm -rf -- "$stage/authority" "$stage/operator-tmp"
|
||||
if getent passwd "$account"; then exit 1; fi
|
||||
printf '%s\n' '{"check":"disposable operator and authority files removed","result":"PASS"}' >> "$out/checks.jsonl"
|
||||
bash scripts/ci-check.sh > "$out/framework-ci.txt" 2>&1 || { tail -80 "$out/framework-ci.txt" >&2; exit 1; }
|
||||
python3 -B bin/absdev-deploy capabilities > "$out/capabilities-after.json"
|
||||
cmp "$out/capabilities-before.json" "$out/capabilities-after.json"
|
||||
(cd "$out" && sha256sum ./* > SHA256SUMS)
|
||||
tar -czf - -C "$out" .
|
||||
@@ -0,0 +1,3 @@
|
||||
host=absdev-ci
|
||||
revision=2719378f67da153f0210b886d66e8e2b68cf6c01
|
||||
operator_uid=1001
|
||||
@@ -0,0 +1,44 @@
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path("tests/unit").resolve()))
|
||||
from test_approval_store import ApprovalStoreTests
|
||||
from core.approval_store import ApprovalStore, ApprovalStoreError
|
||||
from core.operator_approval import FileOperatorAuthority
|
||||
|
||||
fixture = ApprovalStoreTests()
|
||||
try:
|
||||
fixture.setUp()
|
||||
assert os.geteuid() > 0
|
||||
fixture.store = ApprovalStore(
|
||||
fixture.root, operator_policy=FileOperatorAuthority(sys.argv[1], group=os.getegid())
|
||||
)
|
||||
original_draft = fixture.approval
|
||||
for action in sys.stdin:
|
||||
action = action.strip()
|
||||
if action == "issue":
|
||||
from core.approval import issue_approval
|
||||
fixture.approval = issue_approval(fixture.context, approver=original_draft["approver"],
|
||||
now=fixture.now)
|
||||
fixture.identifier = fixture.approval["approval_id"]
|
||||
fixture.save()
|
||||
print("issued", flush=True)
|
||||
elif action == "consume":
|
||||
result = fixture.consume()
|
||||
assert result["migration_executed"] is False
|
||||
print("consumed", flush=True)
|
||||
else:
|
||||
try:
|
||||
fixture.consume()
|
||||
except ApprovalStoreError as error:
|
||||
marker = fixture.store.consumed_path(fixture.identifier)
|
||||
if action == "replay":
|
||||
assert "already consumed" in str(error) and marker.exists()
|
||||
else:
|
||||
assert not marker.exists()
|
||||
print("rejected", flush=True)
|
||||
else:
|
||||
raise AssertionError("Expected rejection")
|
||||
finally:
|
||||
fixture.doCleanups()
|
||||
@@ -24,9 +24,6 @@ class ContainedServiceTests(unittest.TestCase):
|
||||
self.config, self.run_command, gate_directory=self.directory,
|
||||
ingress_sealed=lambda: self.gate.is_file() and self.probe_ok,
|
||||
worker_running=lambda _name: self.running,
|
||||
topology_runner=lambda _command, **_options: json.dumps({
|
||||
"networks": {self.config["docker"]["backend_network"]: {"internal": True}},
|
||||
}),
|
||||
)
|
||||
|
||||
def run_command(self, args, *, timeout):
|
||||
|
||||
@@ -19,14 +19,10 @@ class ServiceTests(unittest.TestCase):
|
||||
)
|
||||
|
||||
self.runner = Mock(return_value=0)
|
||||
self.topology = Mock(return_value=json.dumps({
|
||||
"networks": {self.config["docker"]["backend_network"]: {"internal": True}},
|
||||
}))
|
||||
|
||||
self.manager = ServiceLifecycle(
|
||||
self.config,
|
||||
self.runner,
|
||||
topology_runner=self.topology,
|
||||
)
|
||||
|
||||
self.prefix = [
|
||||
@@ -78,26 +74,6 @@ class ServiceTests(unittest.TestCase):
|
||||
],
|
||||
)
|
||||
|
||||
def test_external_backend_blocks_start_and_restart(self):
|
||||
self.topology.return_value = json.dumps({
|
||||
"networks": {self.config["docker"]["backend_network"]: {"external": True}},
|
||||
})
|
||||
for operation in (self.manager.resume, self.manager.restart_php):
|
||||
with self.assertRaisesRegex(ServiceError, "External Compose backend"):
|
||||
operation()
|
||||
self.runner.assert_not_called()
|
||||
self.topology.assert_called_with(
|
||||
(*self.prefix, "config", "--format", "json"), timeout=30,
|
||||
)
|
||||
|
||||
def test_unverifiable_backend_fails_closed(self):
|
||||
for model in ("invalid json", '{"networks": {}}', '{"networks": null}'):
|
||||
with self.subTest(model=model):
|
||||
self.topology.return_value = model
|
||||
with self.assertRaisesRegex(ServiceError, "Unable to verify"):
|
||||
self.manager.resume()
|
||||
self.runner.assert_not_called()
|
||||
|
||||
def test_validate_nginx(self):
|
||||
|
||||
self.manager.validate_nginx()
|
||||
@@ -172,7 +148,6 @@ class ServiceTests(unittest.TestCase):
|
||||
manager = ServiceLifecycle(
|
||||
self.config,
|
||||
self.runner,
|
||||
topology_runner=self.topology,
|
||||
)
|
||||
|
||||
manager.restart_php()
|
||||
@@ -189,7 +164,6 @@ class ServiceTests(unittest.TestCase):
|
||||
manager = ServiceLifecycle(
|
||||
self.config,
|
||||
self.runner,
|
||||
topology_runner=self.topology,
|
||||
)
|
||||
|
||||
manager.validate_nginx()
|
||||
@@ -207,7 +181,6 @@ class ServiceTests(unittest.TestCase):
|
||||
manager = ServiceLifecycle(
|
||||
self.config,
|
||||
self.runner,
|
||||
topology_runner=self.topology,
|
||||
)
|
||||
|
||||
manager.quiesce()
|
||||
|
||||
Reference in New Issue
Block a user