ci: include service coverage in sonar gate

This commit is contained in:
codex 2026-05-16 02:20:39 -03:00
parent 458b07f25d
commit 0cbd9127d9
3 changed files with 8 additions and 5 deletions

2
Jenkinsfile vendored
View File

@ -112,7 +112,7 @@ spec:
config_rc=$? config_rc=$?
( (
cd testing cd testing
go test ./execx ./metrics ./hygiene ./orchestrator ./state ./sshutil ./ups -coverpkg=scm.bstein.dev/bstein/ananke/... -coverprofile=../build/sonar-testing.cover.out go test ./execx ./metrics ./hygiene ./orchestrator ./service ./state ./sshutil ./ups -coverpkg=scm.bstein.dev/bstein/ananke/... -coverprofile=../build/sonar-testing.cover.out
) )
testing_rc=$? testing_rc=$?
set -e set -e

View File

@ -14,7 +14,7 @@ import urllib.error
import urllib.request import urllib.request
DEFAULT_PUSHGATEWAY_URL = "http://platform-quality-gateway.monitoring.svc.cluster.local:9091" DEFAULT_PUSHGATEWAY_URL = "http://platform-quality-gateway.monitoring.svc.cluster.local:9091" # NOSONAR: in-cluster Pushgateway is HTTP-only.
SOURCE_SCAN_ROOTS = ("cmd", "internal", "scripts", "testing") SOURCE_SCAN_ROOTS = ("cmd", "internal", "scripts", "testing")
SOURCE_EXTENSIONS = {".go", ".py", ".sh"} SOURCE_EXTENSIONS = {".go", ".py", ".sh"}
QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"} QUALITY_SUCCESS_STATES = {"ok", "pass", "passed", "success", "compliant"}

View File

@ -62,15 +62,18 @@ class PublishQualityMetricsTest(unittest.TestCase):
self.thread.join(timeout=5) self.thread.join(timeout=5)
def test_relative_artifact_paths_are_repo_rooted(self) -> None: def test_relative_artifact_paths_are_repo_rooted(self) -> None:
repo_root = Path("/tmp/ananke-repo") tmp_dir = tempfile.TemporaryDirectory()
self.addCleanup(tmp_dir.cleanup)
repo_root = Path(tmp_dir.name) / "ananke-repo"
absolute_coverage_path = Path(tmp_dir.name) / "coverage-percent.txt"
self.assertEqual( self.assertEqual(
publisher._resolve_repo_path(repo_root, "build/coverage-percent.txt"), publisher._resolve_repo_path(repo_root, "build/coverage-percent.txt"),
repo_root / "build" / "coverage-percent.txt", repo_root / "build" / "coverage-percent.txt",
) )
self.assertEqual( self.assertEqual(
publisher._resolve_repo_path(repo_root, "/tmp/coverage-percent.txt"), publisher._resolve_repo_path(repo_root, str(absolute_coverage_path)),
Path("/tmp/coverage-percent.txt"), absolute_coverage_path,
) )
def _env_for_gate_status(self, status: int = 0) -> dict[str, str]: def _env_for_gate_status(self, status: int = 0) -> dict[str, str]: