fix(deploy): include legacy longconn profile during migration checks
The exported live-deployment baseline declares longconn under a Compose profile. Default profile filtering can omit the already-running receiver and make preflight report an unexpected service set. Explicitly select only the known longconn profile for config and targeted migration commands. Preserve strict service-set validation and report only missing/extra service names, never resolved environment or secrets. Up still targets connector/router with --no-deps, without starting another receiver. Add regressions for profiled service omission and safe mismatch diagnostics. Validation: 242 passed, 3 skipped (no real PostgreSQL), 30 existing dependency warnings. Tool-specific coverage: 29 passed. Python 3.7 syntax and diff pass. Actual ECS preflight must be rerun to verify its current service set; no remote configuration, key material or running containers were changed.
This commit is contained in:
@@ -91,6 +91,43 @@ def test_preflight_is_read_only_and_redacted(scenario,capsys):
|
||||
assert not any("up" in c or "build" in c or "tag" in c for c in scenario["calls"])
|
||||
|
||||
|
||||
def test_legacy_longconn_profile_included_without_enabling_all_profiles(scenario,monkeypatch):
|
||||
original = deploy.run
|
||||
def profiled(args,*a,**kw):
|
||||
result = original(args,*a,**kw)
|
||||
if args[:2] == ["docker","compose"] and "config" in args:
|
||||
# Mirror Compose's omission of disabled profile services.
|
||||
result["services"]["longconn"]["profiles"] = ["longconn"]
|
||||
if "--profile" not in args or args[args.index("--profile")+1] != "longconn":
|
||||
result["services"].pop("longconn")
|
||||
return result
|
||||
monkeypatch.setattr(deploy,"run",profiled)
|
||||
deploy.preflight(scenario["args"])
|
||||
plan = prepared(scenario)
|
||||
deploy.check(scenario["output"],plan)
|
||||
deploy.build(scenario["output"],plan)
|
||||
deploy.activate(scenario["output"],plan,True)
|
||||
for command in scenario["calls"]:
|
||||
if command[:2] == ["docker","compose"]:
|
||||
assert command[command.index("--profile")+1] == "longconn"
|
||||
assert "*" not in command
|
||||
if "up" in command:
|
||||
assert command[-2:] == ["connector","router"] and "--no-deps" in command
|
||||
|
||||
|
||||
@pytest.mark.parametrize("missing,extra", [("longconn",None),(None,"unexpected-service")])
|
||||
def test_service_mismatch_reports_only_names_and_still_stops(scenario,missing,extra):
|
||||
if missing:
|
||||
scenario["base"]["services"].pop(missing)
|
||||
if extra:
|
||||
scenario["base"]["services"][extra] = {"environment":{"SECRET":"synthetic-do-not-print"}}
|
||||
with pytest.raises(deploy.DeployError) as error:
|
||||
deploy.preflight(scenario["args"])
|
||||
assert (missing or extra) in str(error.value)
|
||||
assert "synthetic" not in str(error.value)
|
||||
assert not scenario["output"].exists()
|
||||
|
||||
|
||||
def test_prepare_preserves_all_seven_files_runtime_identity_and_no_service_changes(scenario,capsys):
|
||||
original = (scenario["live"]/".env").read_bytes()
|
||||
plan = prepared(scenario)
|
||||
|
||||
Reference in New Issue
Block a user