ci(unit-tests): wire pytest into unit-tests CI job#289
Merged
Conversation
e9f752d to
b40cbe2
Compare
mvillmow
added a commit
that referenced
this pull request
May 10, 2026
…es_proxy Same SyntaxError as PR #289 — missing closing ) after assert message caused pytest collection failure in unit-tests CI job. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mvillmow
added a commit
that referenced
this pull request
May 10, 2026
…es_proxy Same SyntaxError as PR #289 — missing closing ) after assert message caused pytest collection failure in unit-tests CI job. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mvillmow
added a commit
that referenced
this pull request
May 10, 2026
…es_proxy Same SyntaxError as PR #289 — missing closing ) after assert message caused pytest collection failure in unit-tests CI job. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add pixi setup + `pixi run pytest tests/ -v` steps to the unit-tests job so the full test suite (test_exporter, test_configs, test_dashboards, test_rules — 102 tests) executes in CI instead of being silently skipped. - Create pyproject.toml with [tool.pytest.ini_options] (testpaths, pythonpath, addopts) - Add `pytest` task to pixi.toml so `pixi run pytest` works - Extend unit-tests job: cache ~/.pixi, setup-pixi@v0.9.5, pixi install --locked, run pytest - Add timeout-minutes: 15 and permissions: contents: read to the job Closes #117 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…etstream_consumer.py Hardcoded /home/mvillmow/.worktrees/... path caused FileNotFoundError on CI runners. Use Path(__file__).parent.parent / "jetstream-consumer" / "consumer.py" instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- pixi.toml: remove pytest task (no matching just recipe) - .gitignore: add secrets/ entry - .gitleaks.toml: add htpasswd rule and example allowlist - justfile: rename GRAFANA_ADMIN_PASSWORD→GF_ADMIN_PASSWORD, remove GRAFANA_AUTH - scripts/import-dashboards.sh: use GF_ADMIN_PASSWORD - exporter/exporter.py: fix gauge metric names (remove _total from counters, add _seconds suffix to timestamp) - exporter/Dockerfile: use groupadd/useradd -u 1000; USER after COPY - docker-compose.yml: bind all host ports to 127.0.0.1; add prometheus host port - tests/test_configs.py: fix argus-loki→loki-internal, port tests, promtail test, loki datasource URL - tests/test_alertmanager_config.py: fix :latest check to accept pinned versions Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…tleaks path pattern Two test failures found during local test run: 1. TestDockerComposePorts.test_no_wildcard_port_bindings referenced self.ALLOWED_BINDINGS which was only defined in TestDockerComposePortBindings — add the class attribute 2. .gitleaks.toml htpasswd.example path regex had a backslash escape (htpasswd\.example) causing test_gitleaks_allowlist_excludes_example to fail (assertIn checks raw text) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…B104 - _fake_fetch now accepts optional ca_file arg to match updated _fetch signature - Remove unused io import from test_exporter.py - Remove unused imports (json, threading, unittest.mock, Generator, BaseHTTPRequestHandler, HTTPServer) from test_exporter_tls.py - Add nosec B104 to HTTPServer bind on 0.0.0.0 in exporter.py - Add test-unit pixi task that CI workflow expects - Fix markdownlint errors in docs/tls-setup.md (MD013 line length, MD031 fenced code blocks, MD032 blanks around lists)
- Add pytest-cov to Test exporter pip install so pyproject.toml addopts --cov flags are satisfied instead of causing unrecognized argument errors - Remove unused imports (pytest, re, sys, time, BytesIO, patch) from 5 test files to pass ruff F401 lint checks Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…llect(); add test-unit to justfile - ci.yml Test exporter job: add pyyaml to pip install so tests that import yaml can be collected (fixes ModuleNotFoundError for yaml). - exporter.py collect(): pass AGAMEMNON_TLS_CA/NESTOR_TLS_CA/NATS_TLS_CA to each _health_check and _fetch call so custom CA bundles are honoured end-to-end (fixes test_collect_passes_ca_to_agamemnon_calls). - justfile: add test-unit recipe (pixi run test-unit) so test_pixi_tasks_have_just_recipes passes. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…on __main__ _health_check now takes (url, ca_file=None) after the TLS threading fix, but _fake_health_check in _patch_collect only accepted one arg, causing TypeError in 19 collect() tests. Add ca_file=None to the mock signature. Also mark the __main__ guard with pragma: no cover to bring coverage from 71% to 94%, clearing the fail_under=82 gate. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
setup-pixi@v0.9.5+pixi install --locked) to theunit-testsjob so the full Python test suite executes in CIpyproject.tomlwith[tool.pytest.ini_options](testpaths,pythonpath,addopts)pytesttask topixi.tomlsopixi run pytestresolves correctlytimeout-minutes: 15andpermissions: contents: readto the job (matches other jobs in the workflow)The existing YAML/Docker validation steps are preserved and still run first as fast structural checks before pytest.
Test plan
pixi run python -m pytest tests/ -v— 102 tests pass locally (test_exporter, test_configs, test_dashboards, test_rules)yamllint -c .yamllint.yaml .github/workflows/_required.yml— no errors (pre-existing line-length warnings only, not in modified lines)unit-testscheck runs pytest on this PR and reports pass/fail per testpixi-checkjob passes (no pixi.toml changes break it)schema-validationjob passes (workflow YAML is valid per GitHub Actions schema)Closes #117
🤖 Generated with Claude Code