Skip to content

Commit ec346dd

Browse files
subzeroidMarcus Bale
andauthored
ci: keep live tests local (#78)
Co-authored-by: Marcus Bale <marcus.bale@gmail.com>
1 parent bfcd545 commit ec346dd

3 files changed

Lines changed: 23 additions & 179 deletions

File tree

.github/workflows/live-tests.yml

Lines changed: 0 additions & 137 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,4 @@ dmypy.json
136136

137137
# user database
138138
db.json
139+
.gstack/

tests/test_project_metadata.py

Lines changed: 22 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -578,56 +578,36 @@ def test_release_workflow_verifies_published_artifacts():
578578
assert "http://127.0.0.1:18080/build" in run_commands
579579

580580

581-
def test_live_tests_workflow_runs_nightly_against_real_session_flow():
582-
workflow = yaml.load((ROOT / ".github" / "workflows" / "live-tests.yml").read_text(), Loader=yaml.BaseLoader)
581+
def test_github_actions_run_offline_regressions_only():
582+
assert not (ROOT / ".github" / "workflows" / "live-tests.yml").exists()
583583

584-
assert workflow["name"] == "Live Tests"
585-
assert workflow["env"]["FORCE_JAVASCRIPT_ACTIONS_TO_NODE24"] == "true"
586-
assert workflow["on"]["workflow_dispatch"] == {}
587-
assert workflow["on"]["schedule"] == [{"cron": "17 3 * * *"}]
588-
589-
job = workflow["jobs"]["live"]
590-
assert job["if"] == "github.repository == 'subzeroid/aiograpi-rest'"
591-
assert job["timeout-minutes"] == "30"
592-
assert job["env"]["TEST_ACCOUNTS_URL"] == "${{ secrets.TEST_ACCOUNTS_URL }}"
593-
assert job["env"]["TEST_ACCOUNTS_COUNT"] == "25"
594-
assert job["env"]["LIVE_ACCOUNT_TIMEOUT"] == "90"
595-
assert job["env"]["LIVE_PAGINATION_ACCOUNTS_COUNT"] == "5"
596-
assert job["env"]["LIVE_PAGINATION_TIMEOUT"] == "180"
597-
assert job["env"]["LIVE_STORY_ACCOUNTS_COUNT"] == "5"
598-
assert job["env"]["LIVE_STORY_TIMEOUT"] == "240"
599-
assert job["env"]["LIVE_MEDIA_ACCOUNTS_COUNT"] == "5"
600-
assert job["env"]["LIVE_MEDIA_TIMEOUT"] == "300"
601-
assert job["env"]["LIVE_API_BASE_URL"] == "http://127.0.0.1:8000"
602-
603-
steps = job["steps"]
604-
assert any(step.get("uses") == "actions/checkout@v6.0.2" for step in steps)
605-
assert any(step.get("uses") == "actions/setup-python@v6.2.0" for step in steps)
584+
for path in sorted((ROOT / ".github" / "workflows").glob("*.yml")):
585+
text = path.read_text()
586+
assert "TEST_ACCOUNTS_URL" not in text, path.name
587+
assert "tests/live" not in text, path.name
588+
assert "-m live" not in text, path.name
606589

607-
run_commands = "\n".join(step.get("run", "") for step in steps)
608-
assert "docker compose up -d api" in run_commands
609-
assert "curl -fsS http://127.0.0.1:8000/health" in run_commands
610-
assert "pytest tests/live -m live -o addopts='' -v" in run_commands
611-
assert "::notice::TEST_ACCOUNTS_URL is not configured; skipping live tests." in run_commands
612-
assert "docker compose logs api" in run_commands
590+
workflow = yaml.load((ROOT / ".github" / "workflows" / "tests.yml").read_text(), Loader=yaml.BaseLoader)
591+
run_commands = "\n".join(
592+
step.get("run", "")
593+
for job in workflow["jobs"].values()
594+
for step in job.get("steps", [])
595+
)
596+
assert "ruff check ." in run_commands
597+
assert "python scripts/generate_aiograpi_coverage.py --check" in run_commands
598+
assert "pytest --cov=. --cov-report=term-missing --cov-fail-under=100" in run_commands
613599

614600

615-
def test_live_tests_cover_published_image_and_paginated_read_lists():
616-
workflow = yaml.load((ROOT / ".github" / "workflows" / "live-tests.yml").read_text(), Loader=yaml.BaseLoader)
601+
def test_local_live_tests_cover_published_image_and_paginated_read_lists():
617602
live_smoke = (ROOT / "tests" / "live" / "test_live_smoke.py").read_text()
618603
http_smoke = (ROOT / "tests" / "live" / "test_live_http_smoke.py").read_text()
619604
readme = (ROOT / "README.md").read_text()
620605

621-
run_commands = "\n".join(
622-
step.get("run", "")
623-
for job in workflow["jobs"].values()
624-
for step in job.get("steps", [])
625-
)
626-
assert "docker rm -f aiograpi-rest-live >/dev/null 2>&1 || true" in run_commands
627-
assert "docker run --pull always" in run_commands
628-
assert "subzeroid/aiograpi-rest:latest" in run_commands
629-
assert 'TEST_ACCOUNTS_COUNT: "5"' in (ROOT / ".github" / "workflows" / "live-tests.yml").read_text()
630-
assert "pytest tests/live/test_live_http_smoke.py -m live -o addopts='' -v" in run_commands
606+
assert "TEST_ACCOUNTS_URL" in live_smoke
607+
assert "TEST_ACCOUNTS_URL" in http_smoke
608+
assert "LIVE_API_BASE_URL" in http_smoke
609+
assert "test_live_http_login_authorize_and_user_about_flow" in http_smoke
610+
assert "test_live_http_story_upload_creates_visible_downloadable_image_story" in http_smoke
631611

632612
for endpoint in (
633613
"/user/posts",

0 commit comments

Comments
 (0)