Skip to content

feat(polarion): add automated Polarion test case sync#7

Closed
rnetser wants to merge 1 commit into
mainfrom
feat/polarion-sync
Closed

feat(polarion): add automated Polarion test case sync#7
rnetser wants to merge 1 commit into
mainfrom
feat/polarion-sync

Conversation

@rnetser

@rnetser rnetser commented Jun 4, 2026

Copy link
Copy Markdown
Owner
What this PR does / why we need it:

Adds scripts/polarion_sync/ package that automatically creates Polarion test cases for new tests on PR merge. Intended to run as a Jenkins post-merge job (triggered by shmee webhook).

Three-stage pipeline:

  1. Scan — AST-based detection of tests missing @pytest.mark.polarion markers (including parametrized tests)
  2. Create — Creates Polarion TestCase work items via pylero, resolves Jira→Epic→Polarion requirements
  3. Inject + Push — Injects @pytest.mark.polarion("CNV-XXXXX") markers, validates diff, pushes to main

Key features:

  • Sibling test case fallback for requirement linking
  • All-or-nothing push gate with strict diff validation
  • Follow-up PR creation when requirement linking fails (assigned to original PR author)
  • Idempotent injection (skips existing markers)
  • SSL verification configurable via POLARION_DISABLE_SSL_VERIFY env var
  • 25 unit tests covering scanner, injector, client, and push gate

Usage:

# Dry-run:
uv run python -m scripts.polarion_sync.main --dry-run

# Scan only:
uv run python -m scripts.polarion_sync.main --scan-only --scan-all

# Jenkins CI:
uv run python -m scripts.polarion_sync.main --pr-author <user> --pr-number <num>

Assisted-by: Claude noreply@anthropic.com

Which issue(s) this PR fixes:
Special notes for reviewer:
jira-ticket:

Add scripts/polarion_sync/ package that auto-creates Polarion test cases
for new tests on PR merge. Three-stage pipeline:
1. Scan merged commit for tests missing @pytest.mark.polarion markers
2. Create Polarion TestCase work items via pylero
3. Inject markers, validate diff, push to main (or create follow-up PR)

Features:
- AST-based scanner detects unlinked tests (including parametrized)
- Jira-Epic-Polarion requirement resolution with caching
- Sibling test case fallback for requirement linking
- All-or-nothing push gate with diff validation
- Follow-up PR creation when requirement linking fails
- Idempotent injection (skips existing markers)
- 25 unit tests covering scanner, injector, client, and push gate

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: rnetser <rnetser@redhat.com>
@rnetser rnetser closed this Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant