Skip to content

Commit

Permalink
Bring back other test jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
dkmiller committed Jan 4, 2025
1 parent 66789e0 commit 780cf8d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
strategy:
matrix:
os:
# - macos-latest
- macos-latest
- ubuntu-latest
# - windows-latest
- windows-latest
python-version:
# - 3.11
- 3.11
- 3.12
# - 3.13
- 3.13

runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -59,9 +59,6 @@ jobs:
cond: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && github.actor != 'dependabot[bot]' }}
if_true: true

- if: ${{ steps.singleton.outputs.value }}
run: pytest -m e2e

- if: ${{ steps.singleton.outputs.value }}
uses: EnricoMi/publish-unit-test-result-action@v2
with:
Expand All @@ -73,6 +70,9 @@ jobs:
with:
use_oidc: true

- if: ${{ steps.singleton.outputs.value }}
run: pytest -m e2e

- uses: actions/upload-artifact@v4
with:
name: release-dists
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Try to add documentation for any new feature you build. When possible it should
mkdocs serve
```

TODO: run end-to-end tests.
The lengthy series of tests in [test_cli_end_to_end.py](./tests/cli/test_cli_end_to_end.py) are
skipped by default. To force them to run, use the command:

```bash
pytest -m e2e
Expand Down
6 changes: 5 additions & 1 deletion ptah/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Kind,
Kubernetes,
Project,
PtahPanic,
Version,
Yaml,
get,
Expand Down Expand Up @@ -126,7 +127,10 @@ def nuke(docker: bool = True, kind: bool = True):
"""
Forcibly delete the Kind cluster, all related resources, and prune dangling Docker images.
"""
_forward(kill=True)
try:
_forward(kill=True)
except SystemExit:
pass

if docker:
get(Docker).prune()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ filterwarnings = [
]
# https://stackoverflow.com/a/60813297
markers = [
"e2e: marks tests as end-to-end (TODO)",
"e2e: marks tests as end-to-end (these will be skipped by default)",
]

[tool.ruff.lint.per-file-ignores]
Expand Down
16 changes: 10 additions & 6 deletions tests/cli/test_cli_end_to_end.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import logging
import time

import httpx
import pytest
from typer.testing import CliRunner

from ptah.cli import app
from ptah.clients import get
from ptah.clients import Shell, get
from ptah.models import OperatingSystem

log = logging.getLogger(__name__)

# https://stackoverflow.com/a/71264963
if get(OperatingSystem) != OperatingSystem.LINUX:
pytest.skip(reason="unsupported", allow_module_level=True)
Expand All @@ -29,7 +34,7 @@ def test_build(in_project):
def test_deploy(in_project):
runner = CliRunner()
result = runner.invoke(app, ["deploy"])
assert result.exit_code == 0, f"STDOUT: {result.stdout} + STDERR: {result.stderr}"
assert result.exit_code == 0, result.stdout


@pytest.mark.e2e
Expand All @@ -43,8 +48,7 @@ def test_deployed_service_is_functional():
assert "headers" in response.json()
success = True
except Exception as e:
print(e)
import time
log.warning(e)

time.sleep(1)

Expand All @@ -55,6 +59,6 @@ def test_deployed_service_is_functional():
def test_nuke(in_project):
runner = CliRunner()
result = runner.invoke(app, ["nuke"])
assert result.exit_code == 0, f"STDOUT: {result.stdout} + STDERR: {result.stderr}"
assert result.exit_code == 0, result.stdout

# TODO: assert no running Kind clusters.
assert not get(Shell).run(["kind", "get", "clusters"])

0 comments on commit 780cf8d

Please sign in to comment.