Fix stale hook and setup pin checks

This commit is contained in:
Nick Sweeting 2026-08-15 21:12:57 -07:00
parent 50cb7cab33
commit d9381db20c
3 changed files with 16 additions and 12 deletions

View File

@ -1660,7 +1660,7 @@ class TestRecoverOrchestratorState:
@pytest.mark.django_db(transaction=True)
@pytest.mark.timeout(300)
@pytest.mark.parametrize("chrome_isolation", ["crawl", "snapshot"])
def test_resume_queued_chrome_wait_reruns_background_prerequisites(
def test_resume_queued_chrome_navigate_reruns_background_prerequisites(
self,
initialized_archive,
recursive_test_site,
@ -1700,21 +1700,25 @@ class TestRecoverOrchestratorState:
)
assert list_process.returncode == 0, list_process.stderr or list_process.stdout
chrome_results = parse_jsonl_output(list_process.stdout)
wait_record = next(record for record in chrome_results if record["hook_name"] == "on_Snapshot__11_chrome_wait")
snapshot_id = wait_record["snapshot_id"]
navigate_record = next(
record
for record in chrome_results
if record["hook_name"] == "on_Snapshot__30_chrome_navigate"
)
snapshot_id = navigate_record["snapshot_id"]
with use_archivebox_db(initialized_archive):
tab_result = ArchiveResult.objects.get(
snapshot_id=snapshot_id,
plugin="chrome",
hook_name="on_Snapshot__10_chrome_tab.daemon.bg",
hook_name="on_Snapshot__01_chrome_tab.daemon.bg",
)
first_tab_process_id = tab_result.process_id
assert first_tab_process_id is not None
update_process = run_archivebox_cmd(
["archiveresult", "update", "--status=queued"],
stdin=next(line for line in list_process.stdout.splitlines() if wait_record["id"] in line) + "\n",
stdin=next(line for line in list_process.stdout.splitlines() if navigate_record["id"] in line) + "\n",
cwd=initialized_archive,
env=env,
timeout=60,
@ -1741,19 +1745,19 @@ class TestRecoverOrchestratorState:
cleanup_process_group(run_process.pid)
with use_archivebox_db(initialized_archive):
wait_result = ArchiveResult.objects.get(
navigate_result = ArchiveResult.objects.get(
snapshot_id=snapshot_id,
plugin="chrome",
hook_name="on_Snapshot__11_chrome_wait",
hook_name="on_Snapshot__30_chrome_navigate",
)
tab_result = ArchiveResult.objects.get(
snapshot_id=snapshot_id,
plugin="chrome",
hook_name="on_Snapshot__10_chrome_tab.daemon.bg",
hook_name="on_Snapshot__01_chrome_tab.daemon.bg",
)
assert run_process.returncode == 0
assert wait_result.status == ArchiveResult.StatusChoices.SUCCEEDED
assert navigate_result.status == ArchiveResult.StatusChoices.SUCCEEDED
assert tab_result.process_id is not None
assert tab_result.process_id != first_tab_process_id

View File

@ -70,7 +70,7 @@ class TestBackgroundHookDetection:
assert foreground_hooks
assert all(".bg." in hook.name for hook in background_hooks)
assert all(".bg." not in hook.name for hook in foreground_hooks)
assert any(hook.name == "on_Snapshot__10_chrome_tab.daemon.bg.js" for hook in background_hooks)
assert any(hook.name == "on_Snapshot__01_chrome_tab.daemon.bg.js" for hook in background_hooks)
assert any(hook.name == "on_Snapshot__06_wget.finite.bg.py" for hook in background_hooks)
assert any(hook.name == "on_Snapshot__93_hashes.py" for hook in foreground_hooks)
@ -227,7 +227,7 @@ class TestHookDiscovery:
hooks = discover_hooks("Snapshot", filter_disabled=False)
hook_names = [h.name for h in hooks]
assert "on_Snapshot__10_chrome_tab.daemon.bg.js" in hook_names
assert "on_Snapshot__01_chrome_tab.daemon.bg.js" in hook_names
assert "on_Snapshot__21_consolelog.daemon.bg.js" in hook_names
assert "on_Snapshot__06_wget.finite.bg.py" in hook_names
assert all(hook.is_file() for hook in hooks)

View File

@ -81,7 +81,7 @@ ARCHIVEBOX_PYTHON="${ARCHIVEBOX_PYTHON:-3.13}"
ARCHIVEBOX_PACKAGE="${ARCHIVEBOX_PACKAGE:-archivebox>=0.9.0rc0,<0.10}"
ARCHIVEBOX_PLATFORM="${ARCHIVEBOX_PLATFORM:-}"
ARCHIVEBOX_COMPOSE_URL="${ARCHIVEBOX_COMPOSE_URL:-https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/${ARCHIVEBOX_BRANCH}/docker-compose.yml}"
ABXPKG_PACKAGE="${ABXPKG_PACKAGE:-abxpkg==1.12.90}"
ABXPKG_PACKAGE="${ABXPKG_PACKAGE:-abxpkg==1.12.91}"
ABXPKG_LIB_DIR="${ABXPKG_LIB_DIR:-$HOME/.cache/archivebox/setup-abxpkg}"
ARCHIVEBOX_HOME_DIR="$HOME/archivebox"
ARCHIVEBOX_DATA_DIR="$ARCHIVEBOX_HOME_DIR/data"