test(release): resolve real historical baseline dependencies
This commit is contained in:
1 parent
91972b0e4f
commit
656f124fe9
2 files changed
+20
-10
No files matched your search
@@ -820,13 +820,15 @@ def run_serial(args, root: Path, target: Path, version: str, original_hash: str,
|
|||||||
raise ValueError("Baseline must precede the target; select an earlier baseline wheel")
|
raise ValueError("Baseline must precede the target; select an earlier baseline wheel")
|
||||||
results = []
|
results = []
|
||||||
system = isolated_environment(root)
|
system = isolated_environment(root)
|
||||||
# Install once per lane, without inherited user pip settings; every case
|
# Version-only fixtures share the target's dependency constraints. Real
|
||||||
# resets only nanobot. No mutable venv or dependency snapshot crosses lanes.
|
# historical packages must resolve their own dependencies for every case.
|
||||||
|
# No mutable venv or dependency snapshot crosses lanes.
|
||||||
with timings.measure("venv"):
|
with timings.measure("venv"):
|
||||||
subprocess.run([sys.executable, "-I", "-B", "-m", "venv", str(environment)], check=True, env=system, timeout=90)
|
subprocess.run([sys.executable, "-I", "-B", "-m", "venv", str(environment)], check=True, env=system, timeout=90)
|
||||||
with timings.measure("initial_dependency_install"):
|
if not args.baseline_wheel:
|
||||||
subprocess.run([str(python), "-I", "-m", "pip", "install", "--only-binary=:all:", str(target)],
|
with timings.measure("initial_dependency_install"):
|
||||||
check=True, env=system, timeout=600, stdout=subprocess.DEVNULL)
|
subprocess.run([str(python), "-I", "-m", "pip", "install", "--only-binary=:all:", str(target)],
|
||||||
|
check=True, env=system, timeout=600, stdout=subprocess.DEVNULL)
|
||||||
write(environment / "nanobot-install.json", {"schema_version": 1, "owner": "nanobot-installer",
|
write(environment / "nanobot-install.json", {"schema_version": 1, "owner": "nanobot-installer",
|
||||||
"environment": str(environment), "extras": []})
|
"environment": str(environment), "extras": []})
|
||||||
for scenario in scenarios:
|
for scenario in scenarios:
|
||||||
@@ -865,8 +867,10 @@ def run_serial(args, root: Path, target: Path, version: str, original_hash: str,
|
|||||||
"target_unmodified": selected == target}
|
"target_unmodified": selected == target}
|
||||||
write(case_root / "case.json", case)
|
write(case_root / "case.json", case)
|
||||||
with timings.measure("baseline_install", scenario=scenario, journey=1):
|
with timings.measure("baseline_install", scenario=scenario, journey=1):
|
||||||
subprocess.run([str(python), "-I", "-m", "pip", "install", "--no-deps", "--force-reinstall", str(baseline)],
|
dependencies = ["--only-binary=:all:"] if args.baseline_wheel else ["--no-deps"]
|
||||||
check=True, env=env, timeout=120, stdout=subprocess.DEVNULL)
|
subprocess.run([str(python), "-I", "-m", "pip", "install", *dependencies,
|
||||||
|
"--force-reinstall", str(baseline)], check=True, env=env,
|
||||||
|
timeout=600 if args.baseline_wheel else 120, stdout=subprocess.DEVNULL)
|
||||||
child = [str(python), "-I", str(Path(__file__).resolve())]
|
child = [str(python), "-I", str(Path(__file__).resolve())]
|
||||||
# Raw logs stay private to this local evidence root, including on success.
|
# Raw logs stay private to this local evidence root, including on success.
|
||||||
with (case_root / "acceptance.log").open("w", encoding="utf-8") as log:
|
with (case_root / "acceptance.log").open("w", encoding="utf-8") as log:
|
||||||
|
|||||||
@@ -534,7 +534,7 @@ def test_controller_error_does_not_print_exception_values_or_commands(tmp_path):
|
|||||||
@pytest.mark.parametrize("version,baseline_version", [
|
@pytest.mark.parametrize("version,baseline_version", [
|
||||||
("0.3.6", None), ("0.4.0", None), ("1.0.0", None), ("0.4.0", "0.3.5"),
|
("0.3.6", None), ("0.4.0", None), ("1.0.0", None), ("0.4.0", "0.3.5"),
|
||||||
])
|
])
|
||||||
def test_serial_lanes_install_dependencies_once_and_keep_recovery_chains_on_the_same_venv(
|
def test_serial_lanes_resolve_baseline_dependencies_and_keep_recovery_chains_on_the_same_venv(
|
||||||
tmp_path, monkeypatch, version, baseline_version,
|
tmp_path, monkeypatch, version, baseline_version,
|
||||||
):
|
):
|
||||||
package = Path(__file__).resolve().parents[1] / "nanobot"
|
package = Path(__file__).resolve().parents[1] / "nanobot"
|
||||||
@@ -549,7 +549,7 @@ def test_serial_lanes_install_dependencies_once_and_keep_recovery_chains_on_the_
|
|||||||
installations.append(Path(command[-1]))
|
installations.append(Path(command[-1]))
|
||||||
Path(command[-1]).mkdir()
|
Path(command[-1]).mkdir()
|
||||||
elif "pip" in command:
|
elif "pip" in command:
|
||||||
(baselines if "--no-deps" in command else dependencies).append(command[0])
|
(baselines if "--force-reinstall" in command else dependencies).append(command)
|
||||||
elif "--phase" in command:
|
elif "--phase" in command:
|
||||||
phase = command[command.index("--phase") + 1]
|
phase = command[command.index("--phase") + 1]
|
||||||
case_root = Path(command[command.index("--output") + 1])
|
case_root = Path(command[command.index("--output") + 1])
|
||||||
@@ -583,8 +583,14 @@ def test_serial_lanes_install_dependencies_once_and_keep_recovery_chains_on_the_
|
|||||||
args = Namespace(baseline_wheel=baseline, commit="a" * 40, dock=False)
|
args = Namespace(baseline_wheel=baseline, commit="a" * 40, dock=False)
|
||||||
results.extend(probe.run_serial(args, root, target, version, original_hash, scenarios,
|
results.extend(probe.run_serial(args, root, target, version, original_hash, scenarios,
|
||||||
Timings(root / "packaged-update-timings.json")))
|
Timings(root / "packaged-update-timings.json")))
|
||||||
assert len(installations) == len(dependencies) == 2 and len(set(installations)) == 2
|
assert len(installations) == len(set(installations)) == 2
|
||||||
|
assert len(dependencies) == (0 if baseline_version else 2)
|
||||||
assert len(baselines) == 9 and len(stages) == 9
|
assert len(baselines) == 9 and len(stages) == 9
|
||||||
|
for command in baselines:
|
||||||
|
# Actual historical constraints must be resolved again after each
|
||||||
|
# successful upgrade, rather than paired with the target's dependencies.
|
||||||
|
assert ("--no-deps" in command) == (baseline_version is None)
|
||||||
|
assert ("--only-binary=:all:" in command) == (baseline_version is not None)
|
||||||
assert sum(1 + ("subsequent_update" in result) for result in results) == 15
|
assert sum(1 + ("subsequent_update" in result) for result in results) == 15
|
||||||
assert digest(target) == original_hash
|
assert digest(target) == original_hash
|
||||||
upgrade = next(result for result in results if result["scenario"] == "upgrade")
|
upgrade = next(result for result in results if result["scenario"] == "upgrade")
|
||||||
|
|||||||
Reference in new issue
Block a user