region HA P3b-2: probe health casing, Standby wording, live fixtures
Window A step A9: the probe compared DescribeAutoScalingInstances HealthStatus to "Healthy", but that API returns "HEALTHY", so every probe refused at preflight. Now case-insensitive. The activity parser also accepts AWS's documented "to Standby" wording (journal evidence only). Roll, probe and fault-client fakes now take their response shapes from sanitized live dev responses (scripts/testdata/region_group_live), fed through AWS.request(); a field audit found no other mismatch. Opus review READY. Squashed from region-ha-p3b2-probe-health into main.
17 files changed,
+734
−48
scripts/region-group-probe.py+2 −1scripts/region-group-roll.py+2 −1scripts/region_group_fault_test.py+34 −1scripts/region_group_live_fixtures.py+50 −0scripts/region_group_probe_test.py+30 −0scripts/region_group_roll_test.py+237 −45scripts/testdata/region_group_live/README.md+9 −0scripts/testdata/region_group_live/describe-auto-scaling-groups.json+129 −0scripts/testdata/region_group_live/describe-auto-scaling-instances.json+34 −0scripts/testdata/region_group_live/describe-instance-information.json+34 −0scripts/testdata/region_group_live/describe-lifecycle-hooks.json+12 −0scripts/testdata/region_group_live/describe-scaling-activities.json+28 −0scripts/testdata/region_group_live/describe-target-health-example-443.json+64 −0scripts/testdata/region_group_live/describe-target-health-example-80.json+64 −0scripts/testdata/region_group_live/edges-g-00000000000000000000.json+1 −0scripts/testdata/region_group_live/edges-g-11111111111111111111.json+1 −0scripts/testdata/region_group_live/status-framed-raw.txt+3 −0
CI failed — run details
diff --git a/scripts/region-group-probe.py b/scripts/region-group-probe.py| index f35213a78..17de903d5 100755 |
| --- a/scripts/region-group-probe.py |
| +++ b/scripts/region-group-probe.py |
| @@ -46,7 +46,8 @@ class Probe(roll.Operator): |
| # Preserve the group membership; use the actual member lifecycle. |
| if iid in result["members"]: |
| result["members"][iid] = member["LifecycleState"] |
| - result["healthy"][iid] = member["HealthStatus"] == "Healthy" |
| + # DescribeAutoScalingInstances uses HEALTHY; DescribeAutoScalingGroups uses Healthy. |
| + result["healthy"][iid] = str(member.get("HealthStatus", "")).upper() == "HEALTHY" |
| else: |
| result["members"].pop(iid, None) |
| super().call("activities", iid=iid) |
diff --git a/scripts/region-group-roll.py b/scripts/region-group-roll.py| index 5340e0503..610fa3dc6 100755 |
| --- a/scripts/region-group-roll.py |
| +++ b/scripts/region-group-roll.py |
| @@ -714,8 +714,9 @@ class AWS: |
| result = [] |
| for row in rows: |
| description = row.get("Description", "") |
| + # AWS documents "to Standby"; keep accepting "into Standby" too. |
| kind = "exit" if "out of Standby" in description else ( |
| - "enter" if "into Standby" in description else None) |
| + "enter" if any(s in description for s in ("to Standby", "into Standby")) else None) |
| if re.search(r"\b" + re.escape(a["iid"]) + r"\b", description) and kind: |
| dt = datetime.fromisoformat(row["StartTime"].replace("Z", "+00:00")) |
| result.append(dict(id=row["ActivityId"], iid=a["iid"], time=dt.timestamp(), kind=kind)) |
diff --git a/scripts/region_group_fault_test.py b/scripts/region_group_fault_test.py| index 2f44faf48..9bc0c6c29 100644 |
| --- a/scripts/region_group_fault_test.py |
| +++ b/scripts/region_group_fault_test.py |
| @@ -22,6 +22,7 @@ from types import SimpleNamespace |
| from scripts.region_group_document_test import pattern |
| from scripts import region_group_frames as frames |
| +from scripts import region_group_live_fixtures as live |
| ROOT = Path(__file__).resolve().parents[1] |
| DIR = ROOT / 'scripts/region-group-fault' |
| @@ -527,6 +528,35 @@ class StaticTests(unittest.TestCase): |
| client.result(nonce + ':BEGIN\n{}\n' + nonce + ':END:1\n', nonce) |
| +class ClientFixtureTests(unittest.TestCase): |
| + def test_client_parses_live_frame_and_refuses_nonzero_or_missing_end(self): |
| + raw = live.frame() |
| + self.assertEqual(json.loads(client.result(raw, live.NONCE)), live.status()) |
| + for broken in (raw.replace(':END:0', ':END:1'), raw.split(live.NONCE + ':END')[0], |
| + raw + raw): |
| + with self.subTest(frame=broken): |
| + with self.assertRaises(RuntimeError): |
| + client.result(broken, live.NONCE) |
| + |
| + def test_client_send_preserves_live_frame_payload(self): |
| + config = dict(profile='example', region='eu-west-1', document='example-document') |
| + with patch.object(client.uuid, 'uuid4', return_value=SimpleNamespace(hex=live.NONCE)), \ |
| + patch.object(frames.roll.AWS, 'invoke', return_value=live.frame()) as invoke: |
| + result = client.send(config, IID, 'status') |
| + self.assertEqual(json.loads(result), live.status()) |
| + self.assertEqual(invoke.call_args.args[:2], ('ssm', 'start-session')) |
| + self.assertEqual(invoke.call_args.kwargs, dict(timeout=120, raw=True)) |
| + |
| + def test_rehearsal_online_parses_live_ssm_shape(self): |
| + api = rehearse.AWS(SimpleNamespace(profile='example', region='eu-west-1')) |
| + raw = live.load('describe-instance-information.json') |
| + raw['InstanceInformationList'] = [r for r in raw['InstanceInformationList'] if r['InstanceId'] == IID] |
| + for ping, expected in (('Online', True), ('ConnectionLost', False), ('Inactive', False)): |
| + raw['InstanceInformationList'][0]['PingStatus'] = ping |
| + with patch.object(api, 'call', return_value=raw): |
| + self.assertIs(api.online(IID), expected) |
| + |
| + |
| class RehearsalAPI(rehearse.AWS): |
| def __init__(self, args, evidence): |
| super().__init__(args) |
| @@ -557,7 +587,10 @@ class RehearsalAPI(rehearse.AWS): |
| if op == ('s3', 'presign'): |
| return 'https://example.invalid/artifact' |
| if op == ('ssm', 'describe-instance-information'): |
| - return {'InstanceInformationList': [{'InstanceId': IID, 'PingStatus': 'Online'}]} |
| + result = live.load('describe-instance-information.json') |
| + result['InstanceInformationList'] = [r for r in result['InstanceInformationList'] |
| + if r['InstanceId'] == IID] |
| + return result |
| if op == ('ssm', 'get-connection-status'): |
| return {'Status': 'connected'} |
| if op == ('ssm', 'send-command'): |
diff --git a/scripts/region_group_live_fixtures.py b/scripts/region_group_live_fixtures.py| new file mode 100644 |
| index 000000000..115ed27d4 |
| --- /dev/null |
| +++ b/scripts/region_group_live_fixtures.py |
| @@ -0,0 +1,50 @@ |
| +import copy |
| +from functools import lru_cache |
| +import json |
| +from pathlib import Path |
| + |
| + |
| +DIRECTORY = Path(__file__).with_name("testdata") / "region_group_live" |
| +MEMBER = "i-0123456789abcdef0" |
| +PEER = "i-0fedcba9876543210" |
| +BOX = "g-00000000000000000000" |
| +PEER_BOX = "g-11111111111111111111" |
| +NONCE = "0" * 32 |
| + |
| + |
| +@lru_cache(maxsize=None) |
| +def _load(name): |
| + return json.loads((DIRECTORY / name).read_text()) |
| + |
| + |
| +def load(name): |
| + return copy.deepcopy(_load(name)) |
| + |
| + |
| +def status(): |
| + return json.loads(frame().splitlines()[1]) |
| + |
| + |
| +def frame(): |
| + return (DIRECTORY / "status-framed-raw.txt").read_text() |
| + |
| + |
| +def configured(name, config, member, peer): |
| + group = _load("describe-auto-scaling-groups.json")["AutoScalingGroups"][0] |
| + replacements = { |
| + MEMBER: member, PEER: peer, |
| + "123456789012": config["account"], |
| + "example-group": config["group"], "example-launch": config["hook"], |
| + "example": config["deployment"], |
| + group["AutoScalingGroupARN"]: config["group_arn"], |
| + **dict(zip(group["TargetGroupARNs"], config["target_groups"])), |
| + } |
| + |
| + def replace(value): |
| + if isinstance(value, dict): |
| + return {k: replace(v) for k, v in value.items()} |
| + if isinstance(value, list): |
| + return [replace(v) for v in value] |
| + return replacements.get(value, value) if isinstance(value, str) else value |
| + |
| + return replace(_load(name)) |
diff --git a/scripts/region_group_probe_test.py b/scripts/region_group_probe_test.py| index b5547b2e8..725c7227d 100644 |
| --- a/scripts/region_group_probe_test.py |
| +++ b/scripts/region_group_probe_test.py |
| @@ -89,6 +89,36 @@ class ProbeTests(unittest.TestCase): |
| with self.path.open() as reader: |
| return [json.loads(line) for line in reader] |
| + def test_instance_health_casing_preflight(self): |
| + for health, accepted in (("HEALTHY", True), ("UNHEALTHY", False)): |
| + with self.subTest(health=health): |
| + original = self.fake.request |
| + |
| + def request(op, args): |
| + result = original(op, args) |
| + if op == "instance": |
| + result[0]["HealthStatus"] = health |
| + return result |
| + |
| + with self.store.lock(), patch.object(self.fake, "request", request): |
| + journal = self.store.create(dict( |
| + kind="probe", transaction="probe-" + roll.uuid.uuid4().hex, |
| + config=self.config, iid=IID, attended_by="test operator")) |
| + try: |
| + engine = self.engine(journal) |
| + if accepted: |
| + engine.preflight(IID) |
| + self.assertIsNotNone(journal.last("validated")) |
| + else: |
| + with self.assertRaisesRegex(roll.Refusal, "Every peer"): |
| + engine.preflight(IID) |
| + self.assertIsNone(journal.last("validated")) |
| + self.assertEqual(self.fake.writes, []) |
| + finally: |
| + journal.add("done", outcome="preflight-test") |
| + journal.close() |
| + self.store.finish() |
| + |
| def test_probe_pass_order(self): |
| self.run_probe() |
| self.assertEqual(self.fake.writes, ["minimum", "enter", "exit", "minimum"]) |
diff --git a/scripts/region_group_roll_test.py b/scripts/region_group_roll_test.py| index 22fe8b03a..5805e4fe5 100644 |
| --- a/scripts/region_group_roll_test.py |
| +++ b/scripts/region_group_roll_test.py |
| @@ -6,6 +6,7 @@ import io |
| import json |
| import os |
| import random |
| +import re |
| import time |
| from collections import Counter |
| from pathlib import Path |
| @@ -17,13 +18,15 @@ import types |
| import unittest |
| from unittest.mock import patch |
| +from scripts import region_group_live_fixtures as live |
| + |
| SPEC = importlib.util.spec_from_file_location( |
| "region_group_roll", Path(__file__).with_name("region-group-roll.py")) |
| roll = importlib.util.module_from_spec(SPEC) |
| SPEC.loader.exec_module(roll) |
| OLD, NEW = "a" * 64, "b" * 64 |
| -IID, PEER = "i-" + "1" * 17, "i-" + "2" * 17 |
| +IID, PEER = live.MEMBER, live.PEER |
| def test_config(state_dir): |
| @@ -48,6 +51,8 @@ class ValidationError(Exception): |
| class Fake: |
| + parse_response = roll.AWS.request |
| + |
| def __init__(self, config): |
| self.c = config |
| self.now = 1800000000.0 |
| @@ -70,6 +75,7 @@ class Fake: |
| self.continues = self.exits = self.launches = self.abandons = 0 |
| self.activity = [] |
| self.used = set() |
| + self.permit_bodies = {} |
| self.after = None |
| self.launch_receipt = True |
| self.publication_lag = 2 |
| @@ -81,13 +87,13 @@ class Fake: |
| def box(self, iid): |
| boot = "boot-" + iid |
| - return dict(v=1, iid=iid, boot_id=boot, account=self.c["account"], |
| - region=self.c["region"], group=self.c["group"], |
| - config_digest="c" * 64, box_ref="g-" + iid[2:], |
| - binary_sha256=OLD, permit={"state": "absent"}, |
| - edge=dict(state="known", pid=100, start_time="100", |
| - identity=boot + ":100:100", started_at=roll.stamp(self.now - 60)), |
| - health=dict(state="healthy", code=200)) |
| + status = live.status() |
| + status.update(iid=iid, boot_id=boot, account=self.c["account"], |
| + region=self.c["region"], group=self.c["group"], |
| + config_digest="c" * 64, box_ref="g-" + iid[2:], binary_sha256=OLD) |
| + status["edge"].update(pid=100, start_time="100", identity=boot + ":100:100", |
| + started_at=roll.stamp(self.now - 60)) |
| + return status |
| def sleep(self, seconds): |
| self.now += seconds |
| @@ -121,44 +127,79 @@ class Fake: |
| raise roll.Uncertain(name) |
| return copy.deepcopy(result) |
| - def perform(self, op, a): |
| - if op == "group": |
| - return dict(name=self.c["group"], arn=self.c["group_arn"], |
| - deployment=self.c["deployment"], region=self.c["region"], |
| - minimum=self.minimum, desired=self.desired, maximum=self.maximum, |
| - members={i: v for i, v in self.states.items() if v != "Terminated"}, healthy={i: True for i in self.states}, |
| - target_groups=self.c["target_groups"], |
| - template={"LaunchTemplateId": "lt-example", "Version": "1"}) |
| - if op == "instance": |
| - iid = a["iid"] |
| - if iid not in self.states or self.states[iid] == "Terminated": |
| - return [] |
| - return [dict(InstanceId=iid, AutoScalingGroupName=self.c["group"], |
| - LifecycleState=self.states[iid], HealthStatus="Healthy", |
| - LaunchTemplate=self.perform("group", {})["template"], |
| - AvailabilityZone=self.c["region"] + "a", ProtectedFromScaleIn=False)] |
| - if op == "targets": |
| + def fixture(self, name): |
| + return live.configured(name, self.c, IID, PEER) |
| + |
| + def invoke(self, service, verb, args, **kwargs): |
| + if verb == "describe-auto-scaling-groups": |
| + result = self.fixture(verb + ".json") |
| + group = result["AutoScalingGroups"][0] |
| + group.update(MinSize=self.minimum, DesiredCapacity=self.desired, MaxSize=self.maximum) |
| + member = group["Instances"][0] |
| + members = {row["InstanceId"]: row for row in group["Instances"]} |
| + group["Instances"] = [dict(copy.deepcopy(members.get(iid, member)), InstanceId=iid, LifecycleState=state) |
| + for iid, state in self.states.items() if state != "Terminated"] |
| + return result |
| + if verb == "describe-auto-scaling-instances": |
| + iid = args[args.index("--instance-ids") + 1] |
| + result = self.fixture(verb + ".json") |
| + member = next((r for r in result["AutoScalingInstances"] if r["InstanceId"] == iid), |
| + result["AutoScalingInstances"][0]) |
| + result["AutoScalingInstances"] = ([] if iid not in self.states or self.states[iid] == "Terminated" |
| + else [dict(member, InstanceId=iid, LifecycleState=self.states[iid])]) |
| + return result |
| + if verb == "describe-target-health": |
| if (self.target_ready_at is not None and self.now >= self.target_ready_at |
| and self.states[IID] in {"InService", "PreInService", "Pending:Proceed"}): |
| self.tg[IID] = "healthy" |
| - return dict(self.tg) |
| - if op == "online": |
| - return self.online |
| - if op == "hooks": |
| - return dict(name=self.c["hook"], timeout=900, default="ABANDON", |
| - transition="autoscaling:EC2_INSTANCE_LAUNCHING") |
| - if op == "activities": |
| - return self.activity |
| - if op == "edges": |
| + arn = args[args.index("--target-group-arn") + 1] |
| + port = (443, 80)[self.c["target_groups"].index(arn)] |
| + result = self.fixture(f"describe-target-health-example-{port}.json") |
| + target = result["TargetHealthDescriptions"][0] |
| + rows = [] |
| + for iid, state in self.tg.items(): |
| + row = copy.deepcopy(target) |
| + row["Target"]["Id"] = iid |
| + row["TargetHealth"]["State"] = state |
| + rows.append(row) |
| + result["TargetHealthDescriptions"] = rows |
| + return result |
| + if verb == "describe-instance-information": |
| + iid = json.loads(args[args.index("--filters") + 1])[0]["Values"][0] |
| + result = self.fixture(verb + ".json") |
| + result["InstanceInformationList"] = [r for r in result["InstanceInformationList"] |
| + if r["InstanceId"] == iid] |
| + for row in result["InstanceInformationList"]: |
| + row["PingStatus"] = "Online" if self.online else "ConnectionLost" |
| + return result |
| + if verb == "describe-lifecycle-hooks": |
| + return self.fixture(verb + ".json") |
| + if verb == "describe-scaling-activities": |
| + result = self.fixture(verb + ".json") |
| + activity = result["Activities"][0] |
| + # Transition states are synthetic; the captured activities are launches. |
| + result["Activities"] = [dict(copy.deepcopy(activity), ActivityId=a["id"], |
| + Description="Moving EC2 instance " + ("out of" if a["kind"] == "exit" else "to") + |
| + " Standby: " + a["iid"], StartTime=roll.stamp(a["time"])) for a in self.activity] |
| + return result |
| + if verb == "get-object": |
| if self.outage: |
| raise roll.Uncertain("edges") |
| - iid = next(i for i, s in self.boxes.items() if s["box_ref"] == a["box_ref"]) |
| + box_ref = Path(args[args.index("--key") + 1]).stem |
| + iid = next(i for i, status in self.boxes.items() if status["box_ref"] == box_ref) |
| started = roll.instant(self.boxes[iid]["edge"]["started_at"]) |
| lag = self.publication_lag if iid == IID else 2 |
| if self.now >= started + lag: |
| self.published[iid] = started + lag |
| - return dict(v=1, box=a["box_ref"], generation=roll.stamp(self.published[iid]), |
| - admitted=self.admitted, box_role="serve") |
| + result = live.load("edges-" + (live.BOX if iid == IID else live.PEER_BOX) + ".json") |
| + result.update(box=box_ref, box_id=box_ref, generation=roll.stamp(self.published[iid]), |
| + admitted=self.admitted) |
| + return result |
| + raise AssertionError((service, verb, args, kwargs)) |
| + |
| + def perform(self, op, a): |
| + if op in {"group", "instance", "targets", "online", "hooks", "activities", "edges"}: |
| + return self.parse_response(op, a) |
| if op == "minimum": |
| self.minimum = a["value"] |
| self.desired = max(self.desired, self.minimum) |
| @@ -218,23 +259,28 @@ class Fake: |
| assert self.states[IID] == "Standby" and self.tg[IID] == "unused" |
| assert self.desired == self.minimum == 1 and self.maximum == 2 |
| assert (p["transaction"], p["action"]) not in self.used |
| - s["permit"] = dict(p, state="present", accepted=True, consumed=False) |
| + self.permit_bodies[a["iid"]] = copy.deepcopy(p) |
| + s["permit"] = live.status()["permit"] |
| + s["permit"].update({k: p[k] for k in ("transaction", "action", "expires")}, |
| + state="present", accepted=True, consumed=False, rollback_consumed=False) |
| return s |
| if verb == "revoke": |
| - s["permit"] = {"state": "absent"} |
| + s["permit"] = live.status()["permit"] |
| + self.permit_bodies.pop(a["iid"], None) |
| return {} |
| if verb in ("apply", "rollback"): |
| p = s["permit"] |
| assert p["action"] == verb and p["accepted"] and not p["consumed"] |
| assert self.states[IID] == "Standby" |
| self.used.add((p["transaction"], verb)) |
| - s["binary_sha256"] = p["new_sha256"] if verb == "apply" else p["old_sha256"] |
| + body = self.permit_bodies[a["iid"]] |
| + s["binary_sha256"] = body["new_sha256"] if verb == "apply" else body["old_sha256"] |
| s["edge"].update(pid=101 if verb == "apply" else 102, |
| identity=verb + "-process", started_at=roll.stamp(self.now)) |
| self.now += 1 |
| if self.outage: |
| self.admitted = False |
| - s["health"] = dict(state="unhealthy", code=503) |
| + s["health"].update(state="unhealthy", code=503) |
| return {} |
| raise AssertionError((op, a)) |
| @@ -1314,6 +1360,148 @@ class RoundTwoTests(unittest.TestCase): |
| self.assertEqual(self.fake.calls, calls) |
| +class LiveFixtureTests(unittest.TestCase): |
| + def setUp(self): |
| + self.group = live.load("describe-auto-scaling-groups.json")["AutoScalingGroups"][0] |
| + self.config = dict(test_config("/unused"), account="123456789012", |
| + group_arn=self.group["AutoScalingGroupARN"], |
| + target_groups=self.group["TargetGroupARNs"]) |
| + self.adapter = roll.AWS(self.config) |
| + |
| + def parse(self, op, name, **args): |
| + raw = live.load(name) |
| + with patch.object(self.adapter, "invoke", return_value=raw) as invoke: |
| + result = self.adapter.request(op, args) |
| + self.assertEqual(invoke.call_count, 1) |
| + return result |
| + |
| + def test_live_group_and_instance_parsing(self): |
| + group = self.parse("group", "describe-auto-scaling-groups.json") |
| + self.assertEqual(group, dict(name="example-group", arn=self.config["group_arn"], |
| + deployment="example", region="eu-west-1", minimum=2, desired=2, maximum=2, |
| + members={IID: "InService", PEER: "InService"}, healthy={IID: True, PEER: True}, |
| + target_groups=self.config["target_groups"], template={ |
| + "LaunchTemplateId": "lt-0123456789abcdef0", |
| + "LaunchTemplateName": "example-group", "Version": "1"})) |
| + rows = self.parse("instance", "describe-auto-scaling-instances.json", iid=IID) |
| + self.assertEqual([r["InstanceId"] for r in rows], [IID, PEER]) |
| + for row in rows: |
| + self.assertEqual(row["HealthStatus"], "HEALTHY") |
| + self.assertEqual(row["LifecycleState"], "InService") |
| + self.assertEqual(row["LaunchTemplate"], group["template"]) |
| + self.assertTrue(all(r["HealthStatus"] == "Healthy" for r in self.group["Instances"])) |
| + |
| + def test_live_targets_both_ports_and_duplicate_registration(self): |
| + expected = {IID: "healthy", PEER: "healthy", |
| + "i-11111111111111111": "healthy", "i-22222222222222222": "healthy"} |
| + for port in (80, 443): |
| + name = f"describe-target-health-example-{port}.json" |
| + with self.subTest(port=port): |
| + self.assertEqual(self.parse("targets", name, arn="example"), expected) |
| + raw = live.load(name) |
| + duplicate = copy.deepcopy(raw["TargetHealthDescriptions"][0]) |
| + duplicate["Target"]["Port"] += 1 |
| + duplicate["TargetHealth"].update(State="draining", Reason="Target.DeregistrationInProgress") |
| + raw["TargetHealthDescriptions"].append(duplicate) |
| + with patch.object(self.adapter, "invoke", return_value=raw): |
| + result = self.adapter.request("targets", {"arn": "example"}) |
| + self.assertEqual(result[duplicate["Target"]["Id"]], "unknown") |
| + |
| + def test_live_online_and_hook_parsing(self): |
| + raw = live.load("describe-instance-information.json") |
| + for iid in (IID, PEER): |
| + row = next(r for r in raw["InstanceInformationList"] if r["InstanceId"] == iid) |
| + for ping, expected in (("Online", True), ("ConnectionLost", False), ("Inactive", False)): |
| + with self.subTest(iid=iid, ping=ping): |
| + response = dict(raw, InstanceInformationList=[dict(row, PingStatus=ping)]) |
| + with patch.object(self.adapter, "invoke", return_value=response): |
| + self.assertIs(self.adapter.request("online", {"iid": iid}), expected) |
| + self.assertEqual(self.parse("hooks", "describe-lifecycle-hooks.json"), |
| + dict(name="example-launch", timeout=900, default="ABANDON", |
| + transition="autoscaling:EC2_INSTANCE_LAUNCHING")) |
| + hook = live.load("describe-lifecycle-hooks.json")["LifecycleHooks"][0] |
| + self.assertIs(type(hook["HeartbeatTimeout"]), int) |
| + |
| + def test_live_activities_are_launches_only(self): |
| + raw = live.load("describe-scaling-activities.json") |
| + self.assertEqual(len(raw["Activities"]), 2) |
| + for row in raw["Activities"]: |
| + self.assertTrue(row["Description"].startswith("Launching a new EC2 instance: ")) |
| + self.assertEqual(row["StatusCode"], "Successful") |
| + self.assertNotIn("ActivityStatusCode", row) |
| + self.assertEqual(self.parse("activities", "describe-scaling-activities.json", iid=IID), []) |
| + |
| + def test_documented_standby_activity_descriptions(self): |
| + for wording, kind in (("to Standby", "enter"), ("into Standby", "enter"), |
| + ("out of Standby", "exit")): |
| + for status in ("InProgress", "PreInService", "Successful"): |
| + with self.subTest(wording=wording, status=status): |
| + raw = live.load("describe-scaling-activities.json") |
| + row = raw["Activities"][0] |
| + row.update(Description="Moving EC2 instance " + wording + ": " + IID, |
| + StatusCode=status) |
| + other = dict(row, Description="Moving EC2 instance " + wording + ": " + PEER) |
| + raw["Activities"] = [row, other, raw["Activities"][1]] |
| + with patch.object(self.adapter, "invoke", return_value=raw): |
| + result = self.adapter.request("activities", dict(iid=IID)) |
| + self.assertEqual(result, [dict(id=row["ActivityId"], iid=IID, |
| + time=1793891898.824, kind=kind)]) |
| + |
| + def test_live_edges_and_root_frame(self): |
| + for box in (live.BOX, live.PEER_BOX): |
| + name = "edges-" + box + ".json" |
| + result = self.parse("edges", name, box_ref=box) |
| + self.assertEqual(result, live.load(name)) |
| + self.assertEqual((result["v"], result["box"], result["box_role"]), (1, box, "serve")) |
| + self.assertIs(result["admitted"], True) |
| + self.assertGreater(roll.instant(result["generation"]), 0) |
| + with patch.object(roll.uuid, "uuid4", return_value=types.SimpleNamespace(hex=live.NONCE)), \ |
| + patch.object(self.adapter, "invoke", return_value=live.frame()): |
| + status = self.adapter.request("session", dict(iid=IID, verb="status")) |
| + self.assertEqual(status, live.status()) |
| + self.assertIsNone(status["permit"]["accepted"]) |
| + self.assertIsNone(status["edge"]["error"]) |
| + self.assertIs(type(status["edge"]["pid"]), int) |
| + self.assertIs(type(status["edge"]["start_time"]), str) |
| + operator = roll.Operator(self.config, self.adapter, None, clock=lambda: 0, output=io.StringIO()) |
| + edges = live.load("edges-" + live.BOX + ".json") |
| + with patch.object(self.adapter, "request", side_effect=[status, edges, status]): |
| + observation = operator.readiness(IID) |
| + self.assertEqual(observation["status"], status) |
| + |
| + def test_fake_status_preserves_live_permit_shape(self): |
| + fake = Fake(self.config) |
| + fake.states[IID], fake.tg[IID] = "Standby", "unused" |
| + fake.minimum = fake.desired = 1 |
| + permit = dict(v=1, transaction="example", action="apply", expires=int(fake.now) + 3600, |
| + old_sha256=OLD, new_sha256=NEW, phase="mutation", allow_rollback=True) |
| + expected = live.status()["permit"] |
| + for verb, args in (("permit", dict(permit=permit)), ("apply", {}), ("revoke", {})): |
| + with self.subTest(verb=verb): |
| + fake.perform("session", dict(iid=IID, verb=verb, **args)) |
| + status = fake.perform("session", dict(iid=IID, verb="status")) |
| + self.assertEqual(list(status["permit"]), list(expected)) |
| + |
| + def test_fixtures_contain_no_live_identifiers(self): |
| + # Allow-list the placeholder shapes instead of naming real identifiers here. |
| + forbidden = ("640012953448", "carlos-dev", "oncarlos.com", "172.31.", "fe80::") |
| + instances = {"i-0123456789abcdef0", "i-0fedcba9876543210", |
| + "i-11111111111111111", "i-22222222222222222"} |
| + boxes = {"g-00000000000000000000", "g-11111111111111111111"} |
| + documentation = ("192.0.2.", "198.51.100.", "203.0.113.") |
| + for path in live.DIRECTORY.rglob("*"): |
| + if path.is_file(): |
| + body = path.name + path.read_text() |
| + for value in forbidden: |
| + with self.subTest(file=path.name, forbidden=value): |
| + self.assertNotIn(value, body) |
| + with self.subTest(file=path.name, kind="identifiers"): |
| + self.assertLessEqual(set(re.findall(r"\bi-[0-9a-f]{8,17}\b", body)), instances) |
| + self.assertLessEqual(set(re.findall(r"\bg-[0-9a-f]{20}\b", body)), boxes) |
| + for address in re.findall(r"\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b", body): |
| + self.assertTrue(address.startswith(documentation), address) |
| + |
| + |
| class AdapterTests(unittest.TestCase): |
| setUp = StandbyTests.setUp |
| @@ -1380,9 +1568,13 @@ class AdapterTests(unittest.TestCase): |
| def invoke(service, verb, args, **kwargs): |
| calls.append((service, verb, args, kwargs)) |
| if verb == "exit-standby": |
| - return {"Activities": [{"ActivityId": "activity"}]} |
| + result = live.load("describe-scaling-activities.json") |
| + row = result["Activities"][0] |
| + row.update(ActivityId="activity", Description="Moving EC2 instance out of Standby: " + IID) |
| + result["Activities"] = [row] |
| + return result |
| if verb == "get-object": |
| - return {"admitted": True} |
| + return live.load("edges-" + live.BOX + ".json") |
| if verb == "start-session": |
| params = json.loads(args[args.index("--parameters") + 1]) |
| command = params["command"][0] |
| @@ -1391,7 +1583,7 @@ class AdapterTests(unittest.TestCase): |
| self.assertIn("/opt/carlos/carlos system", command) |
| self.assertNotIn("systemctl", command) |
| nonce = roll.re.search(r"([0-9a-f]{32}):BEGIN", command)[1] |
| - return "Starting session\n" + nonce + ":BEGIN\n{}\n" + nonce + ":END:0\nExiting session\n" |
| + return "Starting session\n" + live.frame().replace(live.NONCE, nonce) + "Exiting session\n" |
| return {} |
| with patch.object(adapter, "invoke", side_effect=invoke): |
| @@ -1737,7 +1929,7 @@ class SimulationState: |
| assert path is self.observation |
| c = self.sim.c |
| return dict(v=1, group_arn=c["group_arn"], hook=c["hook"], |
| - template={"LaunchTemplateId": "lt-example", "Version": "1"}, documented_no_hook=True) |
| + template=self.sim.fake.perform("group", {})["template"], documented_no_hook=True) |
| def write(self, path, value): |
| assert path is self.blocked |
diff --git a/scripts/testdata/region_group_live/README.md b/scripts/testdata/region_group_live/README.md| new file mode 100644 |
| index 000000000..055571369 |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/README.md |
| @@ -0,0 +1,9 @@ |
| +Sanitized responses from live dev, 2026-11-05. |
| + |
| +Keep these fixtures byte-faithful in shape: keys, value types, casing, nesting |
| +and ordering. Deployment facts use neutral placeholders. Tests load a fixture, |
| +then override the state fields they drive. |
| + |
| +The captured activities contain launches only. Standby wording is tested |
| +separately against AWS documentation. The root status frame has an absent permit; |
| +no prepare, present-permit or fault-harness status response was captured. |
diff --git a/scripts/testdata/region_group_live/describe-auto-scaling-groups.json b/scripts/testdata/region_group_live/describe-auto-scaling-groups.json| new file mode 100644 |
| index 000000000..7e74e740a |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/describe-auto-scaling-groups.json |
| @@ -0,0 +1,129 @@ |
| +{ |
| + "AutoScalingGroups": [ |
| + { |
| + "AutoScalingGroupName": "example-group", |
| + "AutoScalingGroupARN": "arn:aws:autoscaling:eu-west-1:123456789012:autoScalingGroup:00000000-0000-0000-0000-000000000000:autoScalingGroupName/example-group", |
| + "LaunchTemplate": { |
| + "LaunchTemplateId": "lt-0123456789abcdef0", |
| + "LaunchTemplateName": "example-group", |
| + "Version": "1" |
| + }, |
| + "MinSize": 2, |
| + "MaxSize": 2, |
| + "DesiredCapacity": 2, |
| + "DefaultCooldown": 300, |
| + "AvailabilityZones": [ |
| + "eu-west-1c", |
| + "eu-west-1a" |
| + ], |
| + "AvailabilityZoneIds": [ |
| + "euw1-az1", |
| + "euw1-az2" |
| + ], |
| + "LoadBalancerNames": [], |
| + "TargetGroupARNs": [ |
| + "arn:aws:elasticloadbalancing:eu-west-1:123456789012:targetgroup/example-443/1111111111111111", |
| + "arn:aws:elasticloadbalancing:eu-west-1:123456789012:targetgroup/example-80/2222222222222222" |
| + ], |
| + "HealthCheckType": "ELB", |
| + "HealthCheckGracePeriod": 60, |
| + "Instances": [ |
| + { |
| + "InstanceId": "i-0123456789abcdef0", |
| + "InstanceType": "t3.micro", |
| + "AvailabilityZone": "eu-west-1a", |
| + "AvailabilityZoneId": "euw1-az2", |
| + "LifecycleState": "InService", |
| + "HealthStatus": "Healthy", |
| + "LaunchTemplate": { |
| + "LaunchTemplateId": "lt-0123456789abcdef0", |
| + "LaunchTemplateName": "example-group", |
| + "Version": "1" |
| + }, |
| + "ProtectedFromScaleIn": false |
| + }, |
| + { |
| + "InstanceId": "i-0fedcba9876543210", |
| + "InstanceType": "t3.micro", |
| + "AvailabilityZone": "eu-west-1c", |
| + "AvailabilityZoneId": "euw1-az1", |
| + "LifecycleState": "InService", |
| + "HealthStatus": "Healthy", |
| + "LaunchTemplate": { |
| + "LaunchTemplateId": "lt-0123456789abcdef0", |
| + "LaunchTemplateName": "example-group", |
| + "Version": "1" |
| + }, |
| + "ProtectedFromScaleIn": false |
| + } |
| + ], |
| + "CreatedTime": "2026-11-05T15:18:15.266000+00:00", |
| + "SuspendedProcesses": [ |
| + { |
| + "ProcessName": "AZRebalance", |
| + "SuspensionReason": "User suspended at 2026-11-05T15:18:15Z" |
| + } |
| + ], |
| + "VPCZoneIdentifier": "subnet-0123456789abcdef0,subnet-0fedcba9876543210", |
| + "EnabledMetrics": [ |
| + { |
| + "Metric": "GroupDesiredCapacity", |
| + "Granularity": "1Minute" |
| + }, |
| + { |
| + "Metric": "GroupInServiceInstances", |
| + "Granularity": "1Minute" |
| + } |
| + ], |
| + "Tags": [ |
| + { |
| + "ResourceId": "example-group", |
| + "ResourceType": "auto-scaling-group", |
| + "Key": "Name", |
| + "Value": "example-group", |
| + "PropagateAtLaunch": true |
| + }, |
| + { |
| + "ResourceId": "example-group", |
| + "ResourceType": "auto-scaling-group", |
| + "Key": "carlos:deployment", |
| + "Value": "example", |
| + "PropagateAtLaunch": true |
| + }, |
| + { |
| + "ResourceId": "example-group", |
| + "ResourceType": "auto-scaling-group", |
| + "Key": "carlos:region", |
| + "Value": "example-region", |
| + "PropagateAtLaunch": true |
| + } |
| + ], |
| + "TerminationPolicies": [ |
| + "Default" |
| + ], |
| + "NewInstancesProtectedFromScaleIn": false, |
| + "ServiceLinkedRoleARN": "arn:aws:iam::123456789012:role/aws-service-role/autoscaling.amazonaws.com/AWSServiceRoleForAutoScaling", |
| + "TrafficSources": [ |
| + { |
| + "Identifier": "arn:aws:elasticloadbalancing:eu-west-1:123456789012:targetgroup/example-443/1111111111111111", |
| + "Type": "elbv2" |
| + }, |
| + { |
| + "Identifier": "arn:aws:elasticloadbalancing:eu-west-1:123456789012:targetgroup/example-80/2222222222222222", |
| + "Type": "elbv2" |
| + } |
| + ], |
| + "AvailabilityZoneDistribution": { |
| + "CapacityDistributionStrategy": "balanced-best-effort" |
| + }, |
| + "CapacityReservationSpecification": { |
| + "CapacityReservationPreference": "default" |
| + }, |
| + "InstanceLifecyclePolicy": { |
| + "RetentionTriggers": { |
| + "TerminateHookAbandon": "terminate" |
| + } |
| + } |
| + } |
| + ] |
| +} |
diff --git a/scripts/testdata/region_group_live/describe-auto-scaling-instances.json b/scripts/testdata/region_group_live/describe-auto-scaling-instances.json| new file mode 100644 |
| index 000000000..f98767342 |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/describe-auto-scaling-instances.json |
| @@ -0,0 +1,34 @@ |
| +{ |
| + "AutoScalingInstances": [ |
| + { |
| + "InstanceId": "i-0123456789abcdef0", |
| + "InstanceType": "t3.micro", |
| + "AutoScalingGroupName": "example-group", |
| + "AvailabilityZone": "eu-west-1a", |
| + "AvailabilityZoneId": "euw1-az2", |
| + "LifecycleState": "InService", |
| + "HealthStatus": "HEALTHY", |
| + "LaunchTemplate": { |
| + "LaunchTemplateId": "lt-0123456789abcdef0", |
| + "LaunchTemplateName": "example-group", |
| + "Version": "1" |
| + }, |
| + "ProtectedFromScaleIn": false |
| + }, |
| + { |
| + "InstanceId": "i-0fedcba9876543210", |
| + "InstanceType": "t3.micro", |
| + "AutoScalingGroupName": "example-group", |
| + "AvailabilityZone": "eu-west-1c", |
| + "AvailabilityZoneId": "euw1-az1", |
| + "LifecycleState": "InService", |
| + "HealthStatus": "HEALTHY", |
| + "LaunchTemplate": { |
| + "LaunchTemplateId": "lt-0123456789abcdef0", |
| + "LaunchTemplateName": "example-group", |
| + "Version": "1" |
| + }, |
| + "ProtectedFromScaleIn": false |
| + } |
| + ] |
| +} |
diff --git a/scripts/testdata/region_group_live/describe-instance-information.json b/scripts/testdata/region_group_live/describe-instance-information.json| new file mode 100644 |
| index 000000000..9e93d9b8d |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/describe-instance-information.json |
| @@ -0,0 +1,34 @@ |
| +{ |
| + "InstanceInformationList": [ |
| + { |
| + "InstanceId": "i-0fedcba9876543210", |
| + "PingStatus": "Online", |
| + "LastPingDateTime": "2026-11-05T16:51:58.198000+01:00", |
| + "AgentVersion": "3.3.5708.0", |
| + "IsLatestVersion": true, |
| + "PlatformType": "Linux", |
| + "PlatformName": "Debian GNU/Linux", |
| + "PlatformVersion": "13", |
| + "ResourceType": "EC2Instance", |
| + "IPAddress": "192.0.2.11", |
| + "ComputerName": "example-peer", |
| + "SourceId": "i-0fedcba9876543210", |
| + "SourceType": "AWS::EC2::Instance" |
| + }, |
| + { |
| + "InstanceId": "i-0123456789abcdef0", |
| + "PingStatus": "Online", |
| + "LastPingDateTime": "2026-11-05T16:49:17.118000+01:00", |
| + "AgentVersion": "3.3.5708.0", |
| + "IsLatestVersion": true, |
| + "PlatformType": "Linux", |
| + "PlatformName": "Debian GNU/Linux", |
| + "PlatformVersion": "13", |
| + "ResourceType": "EC2Instance", |
| + "IPAddress": "192.0.2.10", |
| + "ComputerName": "example-member", |
| + "SourceId": "i-0123456789abcdef0", |
| + "SourceType": "AWS::EC2::Instance" |
| + } |
| + ] |
| +} |
diff --git a/scripts/testdata/region_group_live/describe-lifecycle-hooks.json b/scripts/testdata/region_group_live/describe-lifecycle-hooks.json| new file mode 100644 |
| index 000000000..5ec3006f6 |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/describe-lifecycle-hooks.json |
| @@ -0,0 +1,12 @@ |
| +{ |
| + "LifecycleHooks": [ |
| + { |
| + "LifecycleHookName": "example-launch", |
| + "AutoScalingGroupName": "example-group", |
| + "LifecycleTransition": "autoscaling:EC2_INSTANCE_LAUNCHING", |
| + "HeartbeatTimeout": 900, |
| + "GlobalTimeout": 90000, |
| + "DefaultResult": "ABANDON" |
| + } |
| + ] |
| +} |
diff --git a/scripts/testdata/region_group_live/describe-scaling-activities.json b/scripts/testdata/region_group_live/describe-scaling-activities.json| new file mode 100644 |
| index 000000000..dc7d35797 |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/describe-scaling-activities.json |
| @@ -0,0 +1,28 @@ |
| +{ |
| + "Activities": [ |
| + { |
| + "ActivityId": "11111111-1111-1111-1111-111111111111", |
| + "AutoScalingGroupName": "example-group", |
| + "Description": "Launching a new EC2 instance: i-0fedcba9876543210", |
| + "Cause": "At 2026-11-05T15:18:15Z a user request update of AutoScalingGroup constraints to min: 2, max: 2, desired: 2 changing the desired capacity from 0 to 2. At 2026-11-05T15:18:17Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 2.", |
| + "StartTime": "2026-11-05T15:18:18.824000+00:00", |
| + "EndTime": "2026-11-05T15:19:40+00:00", |
| + "StatusCode": "Successful", |
| + "Progress": 100, |
| + "Details": "{\"Availability Zone ID\":\"euw1-az1\",\"Subnet ID\":\"subnet-0fedcba9876543210\",\"Availability Zone\":\"eu-west-1c\"}", |
| + "AutoScalingGroupARN": "arn:aws:autoscaling:eu-west-1:123456789012:autoScalingGroup:00000000-0000-0000-0000-000000000000:autoScalingGroupName/example-group" |
| + }, |
| + { |
| + "ActivityId": "22222222-2222-2222-2222-222222222222", |
| + "AutoScalingGroupName": "example-group", |
| + "Description": "Launching a new EC2 instance: i-0123456789abcdef0", |
| + "Cause": "At 2026-11-05T15:18:15Z a user request update of AutoScalingGroup constraints to min: 2, max: 2, desired: 2 changing the desired capacity from 0 to 2. At 2026-11-05T15:18:17Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 0 to 2.", |
| + "StartTime": "2026-11-05T15:18:18.762000+00:00", |
| + "EndTime": "2026-11-05T15:19:42+00:00", |
| + "StatusCode": "Successful", |
| + "Progress": 100, |
| + "Details": "{\"Availability Zone ID\":\"euw1-az2\",\"Subnet ID\":\"subnet-0123456789abcdef0\",\"Availability Zone\":\"eu-west-1a\"}", |
| + "AutoScalingGroupARN": "arn:aws:autoscaling:eu-west-1:123456789012:autoScalingGroup:00000000-0000-0000-0000-000000000000:autoScalingGroupName/example-group" |
| + } |
| + ] |
| +} |
diff --git a/scripts/testdata/region_group_live/describe-target-health-example-443.json b/scripts/testdata/region_group_live/describe-target-health-example-443.json| new file mode 100644 |
| index 000000000..947b3dd1c |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/describe-target-health-example-443.json |
| @@ -0,0 +1,64 @@ |
| +{ |
| + "TargetHealthDescriptions": [ |
| + { |
| + "Target": { |
| + "Id": "i-11111111111111111", |
| + "Port": 443 |
| + }, |
| + "HealthCheckPort": "80", |
| + "TargetHealth": { |
| + "State": "healthy" |
| + }, |
| + "AdministrativeOverride": { |
| + "State": "no_override", |
| + "Reason": "AdministrativeOverride.NoOverride", |
| + "Description": "No override is currently active on target" |
| + } |
| + }, |
| + { |
| + "Target": { |
| + "Id": "i-22222222222222222", |
| + "Port": 443 |
| + }, |
| + "HealthCheckPort": "80", |
| + "TargetHealth": { |
| + "State": "healthy" |
| + }, |
| + "AdministrativeOverride": { |
| + "State": "no_override", |
| + "Reason": "AdministrativeOverride.NoOverride", |
| + "Description": "No override is currently active on target" |
| + } |
| + }, |
| + { |
| + "Target": { |
| + "Id": "i-0fedcba9876543210", |
| + "Port": 443 |
| + }, |
| + "HealthCheckPort": "80", |
| + "TargetHealth": { |
| + "State": "healthy" |
| + }, |
| + "AdministrativeOverride": { |
| + "State": "no_override", |
| + "Reason": "AdministrativeOverride.NoOverride", |
| + "Description": "No override is currently active on target" |
| + } |
| + }, |
| + { |
| + "Target": { |
| + "Id": "i-0123456789abcdef0", |
| + "Port": 443 |
| + }, |
| + "HealthCheckPort": "80", |
| + "TargetHealth": { |
| + "State": "healthy" |
| + }, |
| + "AdministrativeOverride": { |
| + "State": "no_override", |
| + "Reason": "AdministrativeOverride.NoOverride", |
| + "Description": "No override is currently active on target" |
| + } |
| + } |
| + ] |
| +} |
diff --git a/scripts/testdata/region_group_live/describe-target-health-example-80.json b/scripts/testdata/region_group_live/describe-target-health-example-80.json| new file mode 100644 |
| index 000000000..aac948b07 |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/describe-target-health-example-80.json |
| @@ -0,0 +1,64 @@ |
| +{ |
| + "TargetHealthDescriptions": [ |
| + { |
| + "Target": { |
| + "Id": "i-0fedcba9876543210", |
| + "Port": 80 |
| + }, |
| + "HealthCheckPort": "80", |
| + "TargetHealth": { |
| + "State": "healthy" |
| + }, |
| + "AdministrativeOverride": { |
| + "State": "no_override", |
| + "Reason": "AdministrativeOverride.NoOverride", |
| + "Description": "No override is currently active on target" |
| + } |
| + }, |
| + { |
| + "Target": { |
| + "Id": "i-11111111111111111", |
| + "Port": 80 |
| + }, |
| + "HealthCheckPort": "80", |
| + "TargetHealth": { |
| + "State": "healthy" |
| + }, |
| + "AdministrativeOverride": { |
| + "State": "no_override", |
| + "Reason": "AdministrativeOverride.NoOverride", |
| + "Description": "No override is currently active on target" |
| + } |
| + }, |
| + { |
| + "Target": { |
| + "Id": "i-0123456789abcdef0", |
| + "Port": 80 |
| + }, |
| + "HealthCheckPort": "80", |
| + "TargetHealth": { |
| + "State": "healthy" |
| + }, |
| + "AdministrativeOverride": { |
| + "State": "no_override", |
| + "Reason": "AdministrativeOverride.NoOverride", |
| + "Description": "No override is currently active on target" |
| + } |
| + }, |
| + { |
| + "Target": { |
| + "Id": "i-22222222222222222", |
| + "Port": 80 |
| + }, |
| + "HealthCheckPort": "80", |
| + "TargetHealth": { |
| + "State": "healthy" |
| + }, |
| + "AdministrativeOverride": { |
| + "State": "no_override", |
| + "Reason": "AdministrativeOverride.NoOverride", |
| + "Description": "No override is currently active on target" |
| + } |
| + } |
| + ] |
| +} |
diff --git a/scripts/testdata/region_group_live/edges-g-00000000000000000000.json b/scripts/testdata/region_group_live/edges-g-00000000000000000000.json| new file mode 100644 |
| index 000000000..4ce5edbe5 |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/edges-g-00000000000000000000.json |
| @@ -0,0 +1 @@ |
| +{"box_role":"serve","admitted":true,"drained":false,"v":1,"box":"g-00000000000000000000","eip":"198.51.100.10","region":"eu-west-1","private_ip":"192.0.2.10","private_cidr":"192.0.2.0/24","data_bucket":"example-bucket","data_bucket_region":"eu-west-1","hibernation_configured":true,"serves_shared_pool":false,"accepts_inbound":true,"named_pools":["example-app"],"served_pools":["example-app"],"burst_notices":true,"secrets_key_fp":"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","box_id":"g-00000000000000000000","capabilities":["lifetimes-1","region-ha-1","names-2","offline-move-1","offline-stage-1"],"headroom":{"mem_free_mib":695,"disk_free_mib":17707,"awake":0,"mem_total_mib":927,"disk_total_mib":19925},"moves_protocol":1,"seeds_protocol":1,"addrs":["203.0.113.10","203.0.113.11","192.0.2.10","2001:db8::3","2001:db8::4"],"box_mem_total_mib":927,"generation":"2026-11-05T15:47:45Z","hosts":{"example.com":{"role":"home","platform":true,"account":"example-account","app":"example-app"}}} |
| \ No newline at end of file |
diff --git a/scripts/testdata/region_group_live/edges-g-11111111111111111111.json b/scripts/testdata/region_group_live/edges-g-11111111111111111111.json| new file mode 100644 |
| index 000000000..297e4b4df |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/edges-g-11111111111111111111.json |
| @@ -0,0 +1 @@ |
| +{"box_role":"serve","admitted":true,"drained":false,"v":1,"box":"g-11111111111111111111","eip":"198.51.100.11","region":"eu-west-1","private_ip":"192.0.2.11","private_cidr":"192.0.2.0/24","data_bucket":"example-bucket","data_bucket_region":"eu-west-1","hibernation_configured":true,"serves_shared_pool":false,"accepts_inbound":true,"named_pools":["example-app"],"served_pools":["example-app"],"burst_notices":true,"secrets_key_fp":"sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","box_id":"g-11111111111111111111","capabilities":["lifetimes-1","region-ha-1","names-2","offline-move-1","offline-stage-1"],"headroom":{"mem_free_mib":664,"disk_free_mib":17707,"awake":0,"mem_total_mib":927,"disk_total_mib":19925,"apps":{"example-account/example-app":1}},"moves_protocol":1,"seeds_protocol":1,"addrs":["203.0.113.10","203.0.113.11","192.0.2.11","2001:db8::1","2001:db8::2"],"box_mem_total_mib":927,"generation":"2026-11-05T15:47:44Z","hosts":{"example.com":{"role":"home","platform":true,"account":"example-account","app":"example-app"}}} |
| \ No newline at end of file |
diff --git a/scripts/testdata/region_group_live/status-framed-raw.txt b/scripts/testdata/region_group_live/status-framed-raw.txt| new file mode 100644 |
| index 000000000..9d7e35f2f |
| --- /dev/null |
| +++ b/scripts/testdata/region_group_live/status-framed-raw.txt |
| @@ -0,0 +1,3 @@ |
| +00000000000000000000000000000000:BEGIN |
| +{"v":1,"iid":"i-0123456789abcdef0","boot_id":"01234567-89ab-cdef-0123-456789abcdef","account":"123456789012","region":"eu-west-1","group":"example-group","config_digest":"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","box_ref":"g-00000000000000000000","edge":{"state":"known","pid":1910,"start_time":"4468","started_at":"2026-11-05T15:19:10Z","started_at_error":null,"identity":"01234567-89ab-cdef-0123-456789abcdef:1910:4468","error":null},"binary_sha256":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","binary_error":null,"permit":{"state":"absent","transaction":null,"action":null,"expires":null,"consumed":null,"accepted":null,"rollback_consumed":null,"error":null},"health":{"state":"healthy","code":200,"error":null}} |
| +00000000000000000000000000000000:END:0 |