Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test Suite Validation

on:
pull_request:
branches:
- main
paths:
- 'tests/**'
- 'requirements.txt'
- 'pyproject.toml'
- '.github/workflows/ci.yml'
push:
branches:
- main
paths:
- 'tests/**'
- 'requirements.txt'
- 'pyproject.toml'

jobs:
test-validation:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.11', '3.12']
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pytest ruff


- name: Pytest discovery check
run: python -m pytest --collect-only tests/

- name: Lint check with ruff
run: python -m ruff check tests/
continue-on-error: true
23 changes: 23 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import os
import sys
from unittest.mock import MagicMock

# Inject any missing environment variables required at module import time
os.environ.setdefault("TEST_NAMESPACE", "dummy-namespace")

# Ensure repository root is in sys.path so 'tests.service_catalog...' imports succeed during collection
repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if repo_root not in sys.path:
sys.path.insert(0, repo_root)

# Stub out native GUI/desktop libraries so pytest collection succeeds headlessly
class DummyModule(MagicMock):
def __getattr__(self, name):
return MagicMock()

# Inject dogtail stubs into sys.modules
sys.modules["dogtail"] = DummyModule()
sys.modules["dogtail.rawinput"] = DummyModule()
sys.modules["dogtail.tree"] = DummyModule()
sys.modules["dogtail.utils"] = DummyModule()

3 changes: 3 additions & 0 deletions tests/service_catalog/shared/kube.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
NAMESPACE = os.environ["TEST_NAMESPACE"]
APP_LABEL = os.environ.get("TEST_APP_LABEL", "app=service-catalog-workload")
SERVICE_NAME = os.environ.get("TEST_SERVICE_NAME", "service-catalog")
TEST_NAMESPACE = NAMESPACE
TEST_SERVICE_NAME = SERVICE_NAME
TEST_LANE = os.environ.get("TEST_LANE", "")
RESULTS_DIR = Path(os.environ.get("TEST_RESULTS_DIR", "/tmp/results"))
RESULTS_DIR.mkdir(parents=True, exist_ok=True)



def run_kubectl(*args: str) -> subprocess.CompletedProcess[str]:
return subprocess.run(
["kubectl", *args],
Expand Down
Loading