Publish curated Unraid-AppOps-Gateway source from bc001a6df859f7c9836fa145afb739d1ceebc524
This commit is contained in:
1 parent
631b846397
commit
ab3fa553f0
15 files changed
+3687
-227
No files matched your search
@@ -2349,8 +2349,8 @@ def test_legacy_queue_gate_reads_queued_and_requested_admin_inventories(speciali
|
||||
specialize._check_legacy_queued_jobs()
|
||||
|
||||
assert len(calls) == 2
|
||||
assert "status=pending&limit=100&page=1&sort=id&order=asc" in calls[0]
|
||||
assert "status=queued&limit=100&page=1&sort=id&order=asc" in calls[1]
|
||||
assert "status=pending&limit=50&page=1&sort=id&order=asc" in calls[0]
|
||||
assert "status=queued&limit=50&page=1&sort=id&order=asc" in calls[1]
|
||||
|
||||
|
||||
def test_legacy_queue_gate_blocks_unsupported_requested_dependency_job(specialize, monkeypatch):
|
||||
@@ -2407,7 +2407,7 @@ def test_legacy_queue_gate_catches_requested_to_queued_transition_between_filter
|
||||
assert "status=queued" in calls[1]
|
||||
|
||||
|
||||
def test_legacy_queue_gate_paginates_and_blocks_unsupported_page_two_job(specialize, monkeypatch):
|
||||
def test_legacy_queue_gate_paginates_51_jobs_and_blocks_unsupported_page_two_job(specialize, monkeypatch):
|
||||
calls = []
|
||||
|
||||
def api(path):
|
||||
@@ -2416,15 +2416,15 @@ def test_legacy_queue_gate_paginates_and_blocks_unsupported_page_two_job(special
|
||||
page = int(path.rsplit("page=", 1)[1].split("&", 1)[0])
|
||||
if page == 1:
|
||||
return {
|
||||
"total_count": 101,
|
||||
"total_count": 51,
|
||||
"jobs": [
|
||||
_legacy_queue_job(index + 1, "queued", ["itworx-ci-backend"])
|
||||
for index in range(100)
|
||||
for index in range(50)
|
||||
],
|
||||
}
|
||||
return {
|
||||
"total_count": 101,
|
||||
"jobs": [_legacy_queue_job(101, "queued", ["mcp-validation", "unraid"])],
|
||||
"total_count": 51,
|
||||
"jobs": [_legacy_queue_job(51, "queued", ["mcp-validation", "unraid"])],
|
||||
}
|
||||
if "status=pending" in path:
|
||||
return {"total_count": 0, "jobs": []}
|
||||
@@ -2438,7 +2438,39 @@ def test_legacy_queue_gate_paginates_and_blocks_unsupported_page_two_job(special
|
||||
):
|
||||
specialize._check_legacy_queued_jobs()
|
||||
|
||||
assert any("status=queued&limit=100&page=2" in path for path in calls)
|
||||
assert any("status=queued&limit=50&page=2" in path for path in calls)
|
||||
|
||||
|
||||
def test_legacy_queue_gate_paginates_101_jobs_and_checks_unsupported_last_page(specialize, monkeypatch):
|
||||
calls = []
|
||||
|
||||
def api(path):
|
||||
calls.append(path)
|
||||
if "status=queued" in path:
|
||||
page = int(path.rsplit("page=", 1)[1].split("&", 1)[0])
|
||||
start_id = (page - 1) * 50 + 1
|
||||
page_size = min(50, 101 - (page - 1) * 50)
|
||||
labels = ["mcp-validation", "unraid"] if page == 3 else ["itworx-ci-backend"]
|
||||
return {
|
||||
"total_count": 101,
|
||||
"jobs": [
|
||||
_legacy_queue_job(start_id + offset, "queued", labels)
|
||||
for offset in range(page_size)
|
||||
],
|
||||
}
|
||||
if "status=pending" in path:
|
||||
return {"total_count": 0, "jobs": []}
|
||||
raise AssertionError(f"unexpected fixed Gitea API path: {path}")
|
||||
|
||||
monkeypatch.setattr(specialize, "_api_json", api)
|
||||
|
||||
with pytest.raises(
|
||||
specialize.RunnerFleetSpecializeError,
|
||||
match="runner_fleet_specialization_legacy_queue_present",
|
||||
):
|
||||
specialize._check_legacy_queued_jobs()
|
||||
|
||||
assert any("status=queued&limit=50&page=3" in path for path in calls)
|
||||
|
||||
|
||||
def test_legacy_queue_gate_rejects_total_count_changes_between_pages(specialize, monkeypatch):
|
||||
@@ -2447,15 +2479,15 @@ def test_legacy_queue_gate_rejects_total_count_changes_between_pages(specialize,
|
||||
page = int(path.rsplit("page=", 1)[1].split("&", 1)[0])
|
||||
if page == 1:
|
||||
return {
|
||||
"total_count": 101,
|
||||
"total_count": 51,
|
||||
"jobs": [
|
||||
_legacy_queue_job(index + 1, "queued", ["itworx-ci-backend"])
|
||||
for index in range(100)
|
||||
for index in range(50)
|
||||
],
|
||||
}
|
||||
return {
|
||||
"total_count": 102,
|
||||
"jobs": [_legacy_queue_job(101, "queued", ["itworx-ci-backend"])],
|
||||
"jobs": [_legacy_queue_job(51, "queued", ["itworx-ci-backend"])],
|
||||
}
|
||||
if "status=pending" in path:
|
||||
return {"total_count": 0, "jobs": []}
|
||||
@@ -2470,6 +2502,48 @@ def test_legacy_queue_gate_rejects_total_count_changes_between_pages(specialize,
|
||||
specialize._check_legacy_queued_jobs()
|
||||
|
||||
|
||||
def test_legacy_queue_gate_accepts_maximum_1000_job_inventory(specialize, monkeypatch):
|
||||
calls = []
|
||||
|
||||
def api(path):
|
||||
calls.append(path)
|
||||
page = int(path.rsplit("page=", 1)[1].split("&", 1)[0])
|
||||
start_id = (page - 1) * 50 + 1
|
||||
return {
|
||||
"total_count": 1000,
|
||||
"jobs": [
|
||||
_legacy_queue_job(start_id + offset, "queued", ["itworx-ci-backend"])
|
||||
for offset in range(50)
|
||||
],
|
||||
}
|
||||
|
||||
monkeypatch.setattr(specialize, "_api_json", api)
|
||||
|
||||
rows = specialize._legacy_action_jobs("queued")
|
||||
|
||||
assert len(rows) == 1000
|
||||
assert len(calls) == 20
|
||||
assert "limit=50&page=20" in calls[-1]
|
||||
|
||||
|
||||
def test_legacy_queue_gate_rejects_inventory_over_1000_jobs(specialize, monkeypatch):
|
||||
calls = []
|
||||
|
||||
def api(path):
|
||||
calls.append(path)
|
||||
return {"total_count": 1001, "jobs": []}
|
||||
|
||||
monkeypatch.setattr(specialize, "_api_json", api)
|
||||
|
||||
with pytest.raises(
|
||||
specialize.RunnerFleetSpecializeError,
|
||||
match="runner_fleet_specialization_legacy_queue_untrusted",
|
||||
):
|
||||
specialize._legacy_action_jobs("queued")
|
||||
|
||||
assert len(calls) == 1
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"payload",
|
||||
[
|
||||
@@ -2539,7 +2613,10 @@ def test_image_workflow_builds_from_protected_appops_main_with_gitea_checkout_ur
|
||||
frontend = (ROOT / "ops" / "runner-task-images" / "frontend" / "Dockerfile").read_text(encoding="utf-8")
|
||||
|
||||
assert "github-server-url: http://gitea-runner-internal:3000" in workflow
|
||||
assert "bash scripts/build_ci_task_images.sh" in workflow
|
||||
assert "runs-on: linux-validation" in workflow
|
||||
assert 'bash scripts/build_ci_task_images.sh "$GITHUB_SHA" "$GITHUB_RUN_ID" "$output"' in workflow
|
||||
assert "runs-on: itworx-ci-build" not in workflow
|
||||
assert "--job-local" not in workflow
|
||||
assert "jens/unraid-appops-gateway" in build
|
||||
assert "Jens/Unraid-AppOps-Gateway" in build
|
||||
assert "corepack prepare pnpm@11.15.0 --activate" in frontend
|
||||
|
||||
Reference in new issue
Block a user