Skip to content

net, tests, stuntime: Add OVN localnet migration stuntime scenarios #4833

Merged
rnetser merged 1 commit into
RedHatQE:mainfrom
Anatw:stuntime_add_localnet_scenarios
May 27, 2026
Merged

net, tests, stuntime: Add OVN localnet migration stuntime scenarios #4833
rnetser merged 1 commit into
RedHatQE:mainfrom
Anatw:stuntime_add_localnet_scenarios

Conversation

@Anatw
Copy link
Copy Markdown
Contributor

@Anatw Anatw commented May 12, 2026

Short description:

Complete OVN localnet stuntime coverage for both IP families.

More details:
What this PR does / why we need it:

Add remaining stuntime measurement tests for OVN localnet with both IPv4 and IPv6 coverage, through different migration directions.

Which issue(s) this PR fixes:
Special notes for reviewer:
  • Single parametrized class with class-level ip_family parametrize to group all scenarios per IP family. VMs depend on ip_family so they're recreated per group, giving each IP family fresh VMs with clean network state (4 VMs total).
  • The client VM's affinity towards the server (last client migration scenario) is not cleared before server migration tests - server affinity is set independently and the client's affinity has no effect on server scheduling for this matter.
  • measure_stuntime() is also introduced in PR net, tests, stuntime: Add L2 bridge client migration stuntime scenario #4867. Whichever merges first takes precedence - the other will rebase and remove the duplicate.
jira-ticket:

https://redhat.atlassian.net/browse/CNV-72773

Summary by CodeRabbit

  • Tests
    • Client and server VMs are explicitly labeled; scenarios can enforce client/server co-location or separation before migration.
    • Added a reusable measurement for connectivity gaps; tests now call it and assert against the stuntime threshold.
    • IP family (IPv4/IPv6) is now a class-level parameter for scenarios; ping fixtures and tests accept the injected IP family.
    • Per-scenario test discovery suppression removed.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 63680de2-6c8a-4448-9d64-4ca26ad210d3

📥 Commits

Reviewing files that changed from the base of the PR and between 2a20af4 and 0709307.

📒 Files selected for processing (3)
  • tests/network/localnet/migration_stuntime/conftest.py
  • tests/network/localnet/migration_stuntime/libstuntime.py
  • tests/network/localnet/migration_stuntime/test_migration_stuntime.py

📝 Walkthrough

Walkthrough

Adds a shared stuntime label and CLIENT_VM_LABEL, a measure_stuntime helper, a class-scoped ip_family fixture, updates fixtures to use CLIENT_VM_LABEL and accept ip_family, and refactors migration tests to parametrize IPv4/IPv6 and assert stuntime via measure_stuntime after migrations.

Changes

Stuntime Measurement and Migration Test Refactoring

Layer / File(s) Summary
Client VM label constant & measurement helper
tests/network/localnet/migration_stuntime/libstuntime.py
Adds STUNTIME_LABEL_KEY, CLIENT_VM_LABEL, and measure_stuntime(active_ping) to stop a ContinuousPing, call report(), and return computed stuntime.
Fixture enhancements: ip_family and active_ping
tests/network/localnet/migration_stuntime/conftest.py
Adds a class-scoped ip_family fixture; updates localnet_stuntime_server_vm signature to accept ip_family; sets localnet_stuntime_client_vm vm_labels to CLIENT_VM_LABEL; updates active_ping to accept ip_family directly.
Test parametrization and stuntime assertions
tests/network/localnet/migration_stuntime/test_migration_stuntime.py
Refactors tests to parametrize ip_family (IPv4/IPv6 with marks), updates method signatures to accept ip_family, sets pre-migration affinity/anti-affinity using SERVER_VM_LABEL/CLIENT_VM_LABEL, runs migrations, then calls measure_stuntime(active_ping=...) and asserts against STUNTIME_THRESHOLD_SECONDS.

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels: new-tests

Suggested reviewers:

  • yossisegev
  • dshchedr
  • orelmisan
  • nirdothan
  • servolkov
  • EdDev
  • vsibirsk
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly describes the main change: adding OVN localnet migration stuntime test scenarios with IPv4/IPv6 coverage, and meets the 120-character requirement (68 chars).
Description check ✅ Passed Description includes all required template sections with substantive content: 'What this PR does / why we need it', 'Which issue(s) this PR fixes' (with Jira link), and 'Special notes for reviewer' addressing design choices and potential conflicts.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stp Link Required ✅ Passed PR modifies existing test functions but adds no new test files or new test functions; only 3 existing files are modified. Pass condition satisfied (no Case A/B to check).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-virtualization-qe-bot-4
Copy link
Copy Markdown

Report bugs in Issues

Welcome! 🎉

This pull request will be automatically processed with the following features:

🔄 Automatic Actions

  • Reviewer Assignment: Reviewers are automatically assigned based on the OWNERS file in the repository root
  • Size Labeling: PR size labels (XS, S, M, L, XL, XXL) are automatically applied based on changes
  • Issue Creation: A tracking issue is created for this PR and will be closed when the PR is merged or closed
  • Branch Labeling: Branch-specific labels are applied to track the target branch
  • Auto-verification: Auto-verified users have their PRs automatically marked as verified
  • Labels: Enabled categories: branch, can-be-merged, cherry-pick, has-conflicts, hold, needs-rebase, size, verified, wip

📋 Available Commands

PR Status Management

  • /wip - Mark PR as work in progress (adds WIP: prefix to title)
  • /wip cancel - Remove work in progress status
  • /hold - Block PR merging (approvers only)
  • /hold cancel - Unblock PR merging
  • /verified - Mark PR as verified
  • /verified cancel - Remove verification status
  • /reprocess - Trigger complete PR workflow reprocessing (useful if webhook failed or configuration changed)
  • /regenerate-welcome - Regenerate this welcome message

Review & Approval

  • /lgtm - Approve changes (looks good to me)
  • /approve - Approve PR (approvers only)
  • /assign-reviewers - Assign reviewers based on OWNERS file
  • /assign-reviewer @username - Assign specific reviewer
  • /check-can-merge - Check if PR meets merge requirements

Testing & Validation

  • /retest tox - Run Python test suite with tox
  • /retest build-container - Rebuild and test container image
  • /retest verify-bugs-are-open - verify-bugs-are-open
  • /retest all - Run all available tests

Container Operations

  • /build-and-push-container - Build and push container image (tagged with PR number)
    • Supports additional build arguments: /build-and-push-container --build-arg KEY=value

Cherry-pick Operations

  • /cherry-pick <branch> - Schedule cherry-pick to target branch when PR is merged
    • Multiple branches: /cherry-pick branch1 branch2 branch3

Label Management

  • /<label-name> - Add a label to the PR
  • /<label-name> cancel - Remove a label from the PR

✅ Merge Requirements

This PR will be automatically approved when the following conditions are met:

  1. Approval: /approve from at least one approver
  2. LGTM Count: Minimum 2 /lgtm from reviewers
  3. Status Checks: All required status checks must pass
  4. No Blockers: No wip, hold, has-conflicts labels and PR must be mergeable (no conflicts)
  5. Verified: PR must be marked as verified

📊 Review Process

Approvers and Reviewers

Approvers:

  • EdDev
  • dshchedr
  • myakove
  • rnetser
  • vsibirsk

Reviewers:

  • Anatw
  • EdDev
  • RoniKishner
  • azhivovk
  • dshchedr
  • frenzyfriday
  • nirdothan
  • orelmisan
  • rnetser
  • servolkov
  • vsibirsk
  • yossisegev
Available Labels
  • hold
  • verified
  • wip
  • lgtm
  • approve
AI Features
  • Cherry-Pick Conflict Resolution: Enabled (claude/claude-opus-4-6[1m])

💡 Tips

  • WIP Status: Use /wip when your PR is not ready for review
  • Verification: The verified label is removed on new commits unless the push is detected as a clean rebase
  • Cherry-picking: Cherry-pick labels are processed when the PR is merged
  • Container Builds: Container images are automatically tagged with the PR number
  • Permission Levels: Some commands require approver permissions
  • Auto-verified Users: Certain users have automatic verification and merge privileges

For more information, please refer to the project documentation or contact the maintainers.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/network/localnet/migration_stuntime/libstuntime.py`:
- Line 16: STUNTIME_PING_LOG_PATH is a fixed predictable filename; change it to
generate a unique temporary path to avoid symlink/race attack vectors by
replacing the constant assignment with a temp-based value (e.g., use
tempfile.mkstemp()/tempfile.NamedTemporaryFile() or append a uuid via
uuid.uuid4()) where STUNTIME_PING_LOG_PATH is set, and ensure any code that
opens/writes the log uses that generated path and properly closes/removes the
temp file when done.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e7814698-4f2a-456c-ab03-32ac1213bd1c

📥 Commits

Reviewing files that changed from the base of the PR and between 83afe12 and fc82ca7.

📒 Files selected for processing (7)
  • libs/vm/affinity.py
  • libs/vm/spec.py
  • libs/vm/vm.py
  • tests/network/localnet/liblocalnet.py
  • tests/network/localnet/migration_stuntime/conftest.py
  • tests/network/localnet/migration_stuntime/libstuntime.py
  • tests/network/localnet/migration_stuntime/test_migration_stuntime.py

Comment thread tests/network/localnet/migration_stuntime/libstuntime.py
coderabbitai[bot]
coderabbitai Bot previously approved these changes May 12, 2026
@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 25, 2026

/build-and-push-container

@openshift-virtualization-qe-bot-4
Copy link
Copy Markdown

New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-4833 published

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/network/localnet/migration_stuntime/conftest.py`:
- Around line 32-42: The fixture restarted_vms currently has function scope so
its teardown runs after every test; change the fixture declaration to use
scope='class' (i.e., `@pytest.fixture`(scope='class')) so the yield/teardown that
restarts localnet_stuntime_server_vm and localnet_stuntime_client_vm executes
once after the last test in the class, preserving the intended "after the last
scenario" behavior and ensuring the restart/wait_for_agent_connected calls run
at class teardown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: effe7ec9-75bd-4b5b-9975-13e6647fe10d

📥 Commits

Reviewing files that changed from the base of the PR and between 901117f and aa7dab9.

📒 Files selected for processing (3)
  • tests/network/localnet/migration_stuntime/conftest.py
  • tests/network/localnet/migration_stuntime/libstuntime.py
  • tests/network/localnet/migration_stuntime/test_migration_stuntime.py

Comment thread tests/network/localnet/migration_stuntime/conftest.py Outdated
@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 25, 2026

/verified

Tested on bm03-tlv2
Openshift version: 4.22.0-rc.2
CNV version: 4.22.0
HCO image: brew.registry.redhat.io/rh-osbs/iib:1141649
openshift-virtualization-tests-runner/5326
PYTEST_PARAMS: -s -o log_cli=true -m tier3 --jira --cluster-sanity-skip-storage-check tests/network/localnet/migration_stuntime/test_migration_stuntime.py
==== 12 passed, 1 deselected, 89 warnings in 1845.25s (0:30:45) ====

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post an inline review comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If submitting the review fails after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 25, 2026

Tip

For best results, initiate chat on the files or code changes.

Test Execution Plan

  • Run smoke tests: False — Verified via codebase search: no smoke-marked test file (test_import_registry.py, test_import_http.py, test_upload_virtctl.py, test_clone.py, test_container_disk_vm.py, test_rhel_os_support.py, test_rhel_os.py, test_csv.py) imports or depends on any of the changed modules (libs/vm/affinity.py, libs/vm/spec.py, libs/vm/vm.py, liblocalnet.py, libstuntime.py). No dependency chain exists.

  • tests/network/localnet/migration_stuntime/test_migration_stuntime.py — Full file: all 12 tests (6 migration scenarios × TestMigrationStuntimeIPv4 / TestMigrationStuntimeIPv6). Covers all changes: measure_stuntime() helper, CLIENT_VM_LABEL/SERVER_VM_LABEL constants, ip_family from request.cls.IP_FAMILY, new_pod_affinity/new_pod_anti_affinity placement logic, and docstring cleanup.

@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 26, 2026

/verified

#4833 (comment)

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post an inline review comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If submitting the review fails after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
export GH_TOKEN="${GITHUB_TOKEN}"

echo "=== HEAD SHA ==="
HEAD_SHA=$(gh pr view 4833 --repo RedHatQE/openshift-virtualization-tests --json headRefOid --jq '.headRefOid')
echo "$HEAD_SHA"

echo "=== Smoke test dependency check (quick re-verify) ==="
SMOKE_FILES=$(rg -rl "pytest.mark.smoke" -g "*.py" tests/ 2>/dev/null)
if [ -n "$SMOKE_FILES" ]; then
  OVERLAP=$(echo "$SMOKE_FILES" | xargs grep -l "affinity\|liblocalnet\|libstuntime\|from libs\.vm\.spec\|from libs\.vm\.vm" 2>/dev/null)
  if [ -n "$OVERLAP" ]; then
    echo "OVERLAP FOUND: $OVERLAP"
  else
    echo "No overlap found between smoke tests and changed files"
  fi
else
  echo "No smoke-marked test files found"
fi

echo "=== Get PR files to find first changed line ==="
PR_FILES=$(curl -s \
  -H "Authorization: token ${GITHUB_TOKEN}" \
  -H "Accept: application/vnd.github.v3+json" \
  "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files")

echo "$PR_FILES" | python3 -c "
import json, sys

files = json.load(sys.stdin)
print(f'Total files: {len(files)}')
for i, f in enumerate(files):
    print(f'FILE {i}: {f[\"filename\"]}')
    patch = f.get('patch', '')
    if patch:
        lines = patch.split('\n')
        print(f'  Patch first 5 lines:')
        for l in lines[:5]:
            print(f'    {repr(l)}')
    print()
"

echo "=== HEAD SHA for posting ==="
echo "$HEAD_SHA"

echo "=== Post inline review comment ==="
PR_FILES_JSON=$(curl -s \
  -H "Authorization: token ${GITHUB_TOKEN}" \
  -H "Accept: application/vnd.github.v3+json" \
  "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files")

python3 << 'PYEOF'
import json, os, urllib.request, urllib.error

token = os.environ.get('GITHUB_TOKEN', '')
head_sha = os.popen("gh pr view 4833 --repo RedHatQE/openshift-virtualization-tests --json headRefOid --jq '.headRefOid'").read().strip()
print(f"HEAD SHA: {head_sha}")

# Get PR files
req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files",
    headers={"Authorization": f"token {token}", "Accept": "application/vnd.github.v3+json"}
)
with urllib.request.urlopen(req, timeout=30) as resp:
    files = json.loads(resp.read())

print(f"Got {len(files)} files")
first_file = files[0]
print(f"First file: {first_file['filename']}")
patch = first_file.get('patch', '')
print(f"Patch (first 200 chars): {patch[:200]}")

# Find position of first added line in the patch
# Position 1 = first line of the diff (the @@ header line)
# We want position of the first non-context line (+ or -)
position = 1  # default to 1 (the hunk header)
if patch:
    lines = patch.split('\n')
    for i, line in enumerate(lines):
        if line.startswith('+') and not line.startswith('+++'):
            position = i + 1  # 1-indexed
            print(f"First added line at position {position}: {repr(line[:80])}")
            break

print(f"Using position: {position}")

comment_body = """**Test Execution Plan**

- **Run smoke tests: False** — Verified: no smoke-marked test file imports or depends on any changed module (`libs/vm/affinity.py`, `libs/vm/spec.py`, `libs/vm/vm.py`, `liblocalnet.py`, `libstuntime.py`). Dependency chain confirmed via codebase search.

- `tests/network/localnet/migration_stuntime/test_migration_stuntime.py` — Full file: all 12 tests (6 migration scenarios × `TestMigrationStuntimeIPv4` / `TestMigrationStuntimeIPv6`). Covers all changes: `measure_stuntime()` helper, `CLIENT_VM_LABEL`/`SERVER_VM_LABEL` constants, `ip_family` from `request.cls.IP_FAMILY`, `new_pod_affinity`/`new_pod_anti_affinity` placement logic, and docstring cleanup."""

payload = json.dumps({
    "commit_id": head_sha,
    "path": first_file['filename'],
    "position": position,
    "body": comment_body
}).encode()

post_req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/comments",
    data=payload,
    method="POST",
    headers={
        "Authorization": f"token {token}",
        "Accept": "application/vnd.github.v3+json",
        "Content-Type": "application/json"
    }
)

try:
    with urllib.request.urlopen(post_req, timeout=30) as resp:
        result = json.loads(resp.read())
        print(f"SUCCESS: Comment ID {result.get('id')} on {result.get('path')} position {result.get('position')}")
except urllib.error.HTTPError as e:
    body = e.read().decode()
    print(f"HTTP ERROR {e.code}: {body}")
except Exception as ex:
    print(f"ERROR: {ex}")
PYEOF

Length of output: 7973


🏁 Script executed:

#!/bin/bash

echo "=== Get HEAD SHA from git ==="
HEAD_SHA=$(git rev-parse HEAD)
echo "HEAD SHA: $HEAD_SHA"

echo "=== Changed files ==="
git diff origin/main...HEAD --name-only

echo "=== First changed file and first hunk ==="
FIRST_FILE=$(git diff origin/main...HEAD --name-only | head -1)
echo "First file: $FIRST_FILE"
git diff origin/main...HEAD -- "$FIRST_FILE" | head -30

echo "=== Try curl with --insecure ==="
# Get PR files with curl --insecure
PR_FILES=$(curl -sk \
  -H "Authorization: token ${GITHUB_TOKEN}" \
  -H "Accept: application/vnd.github.v3+json" \
  "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files")

echo "$PR_FILES" | python3 -c "
import json, sys
try:
    files = json.load(sys.stdin)
    print(f'Got {len(files)} files')
    for i, f in enumerate(files):
        print(f'FILE {i}: {f[\"filename\"]}')
        patch = f.get('patch', '')
        if patch:
            lines = patch.split('\n')
            for j, l in enumerate(lines[:6]):
                print(f'  [{j+1}] {repr(l[:100])}')
except Exception as e:
    print(f'Error: {e}')
    print(sys.stdin.read()[:300])
" 2>/dev/null || echo "python parse failed, raw output:"
echo "$PR_FILES" | head -5

echo "=== Post inline comment ==="
python3 << 'PYEOF'
import json, os, ssl, urllib.request, urllib.error

token = os.environ.get('GITHUB_TOKEN', '')

# Create SSL context that skips verification
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

# Get HEAD SHA from git
head_sha = os.popen("git rev-parse HEAD").read().strip()
print(f"HEAD SHA: {head_sha}")

# Get PR files
req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files",
    headers={"Authorization": f"token {token}", "Accept": "application/vnd.github.v3+json"}
)
try:
    with urllib.request.urlopen(req, timeout=30, context=ctx) as resp:
        files = json.loads(resp.read())
except Exception as e:
    print(f"Error getting files: {e}")
    files = []

print(f"Got {len(files)} files")

if not files:
    print("No files found, using fallback")
    # Use git to get first file
    first_filename = os.popen("git diff origin/main...HEAD --name-only | head -1").read().strip()
    
    # Find position using git diff
    diff_output = os.popen(f"git diff origin/main...HEAD -- '{first_filename}'").read()
    lines = diff_output.split('\n')
    position = 1
    for i, line in enumerate(lines):
        if line.startswith('@@'):
            position = i + 2  # position after hunk header
            break
else:
    first_file = files[0]
    first_filename = first_file['filename']
    patch = first_file.get('patch', '')
    print(f"First file: {first_filename}")
    print(f"Patch snippet: {patch[:150]}")
    
    position = 1
    if patch:
        lines = patch.split('\n')
        for i, line in enumerate(lines):
            if line.startswith('+') and not line.startswith('+++'):
                position = i + 1
                print(f"First added line pos={position}: {repr(line[:80])}")
                break

print(f"Posting to file={first_filename} position={position}")

comment_body = """**Test Execution Plan**

- **Run smoke tests: False** — Verified: no smoke-marked test file imports or depends on any changed module (`libs/vm/affinity.py`, `libs/vm/spec.py`, `libs/vm/vm.py`, `liblocalnet.py`, `libstuntime.py`). Dependency chain confirmed via codebase search.

- `tests/network/localnet/migration_stuntime/test_migration_stuntime.py` — Full file: all 12 tests (6 migration scenarios × `TestMigrationStuntimeIPv4` / `TestMigrationStuntimeIPv6`). Covers all changes: `measure_stuntime()` helper, `CLIENT_VM_LABEL`/`SERVER_VM_LABEL` constants, `ip_family` from `request.cls.IP_FAMILY`, `new_pod_affinity`/`new_pod_anti_affinity` placement logic, and docstring cleanup."""

payload = json.dumps({
    "commit_id": head_sha,
    "path": first_filename,
    "position": position,
    "body": comment_body
}).encode()

post_req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/comments",
    data=payload,
    method="POST",
    headers={
        "Authorization": f"token {token}",
        "Accept": "application/vnd.github.v3+json",
        "Content-Type": "application/json"
    }
)

try:
    with urllib.request.urlopen(post_req, timeout=30, context=ctx) as resp:
        result = json.loads(resp.read())
        print(f"SUCCESS: Comment ID={result.get('id')} on path={result.get('path')} pos={result.get('position')}")
except urllib.error.HTTPError as e:
    body = e.read().decode()
    print(f"HTTP ERROR {e.code}: {body[:500]}")
except Exception as ex:
    print(f"ERROR: {ex}")
PYEOF

Length of output: 5877



Test Execution Plan

  • Run smoke tests: False — Verified: no smoke-marked test file imports or depends on any changed module (libs/vm/affinity.py, libs/vm/spec.py, libs/vm/vm.py, liblocalnet.py, libstuntime.py). Dependency chain confirmed via codebase search across all prior runs.

  • tests/network/localnet/migration_stuntime/test_migration_stuntime.py — Full file: all 12 tests (6 migration scenarios × TestMigrationStuntimeIPv4 / TestMigrationStuntimeIPv6). Covers all changes: measure_stuntime() helper, CLIENT_VM_LABEL/SERVER_VM_LABEL constants, ip_family from request.cls.IP_FAMILY, new_pod_affinity/new_pod_anti_affinity placement logic, and docstring cleanup.

Comment thread tests/network/localnet/migration_stuntime/conftest.py Outdated
Comment thread tests/network/localnet/migration_stuntime/test_migration_stuntime.py Outdated
Comment thread tests/network/localnet/migration_stuntime/test_migration_stuntime.py Outdated
Comment thread tests/network/localnet/migration_stuntime/conftest.py Outdated
@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 26, 2026

Change:

  • Add ip_family dependency to server VM fixture — forces VM recreation between IP family groups
  • Remove restarted_vms fixture (no longer needed — fresh VMs reset network stack)
  • Remove scope="class" from parametrize (redundant — fixture scope handles grouping)

@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 26, 2026

/build-and-push-container

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-4833 published

@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 26, 2026

/verified

Tested on bm03-tlv2
Openshift version: 4.22.0-rc.2
CNV version: 4.22.0
HCO image: brew.registry.redhat.io/rh-osbs/iib:1141649
openshift-virtualization-tests-runner/5341
PYTEST_PARAMS: -s -o log_cli=true -m tier3 --jira --cluster-sanity-skip-storage-check tests/network/localnet/migration_stuntime/test_migration_stuntime.py
==== 12 passed, 1 deselected, 85 warnings in 1759.37s (0:29:19) ====

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

@coderabbitai

Test execution plan request details

CRITICAL: You MUST post an inline review comment on the first changed line of the first file.
The inline comment should contain the Test Execution Plan with the smoke tests recommendation.
Do NOT submit a formal review - just post the inline comment directly.

As an expert software testing engineer, analyze all modified files in this PR and create a targeted test execution plan.
You will post an inline review comment with the test execution plan on the first changed file.
If you fail to run or post a comment, retry.

Analysis Requirements:

  1. Examine code changes in each modified file
  2. Identify affected code paths, functions, and classes
  3. Analyze pytest-specific elements: fixtures (scope, dependencies), parametrization, markers, conftest changes
  4. Trace test dependencies through imports, shared utilities, and fixture inheritance
  5. Detect new tests introduced in the PR
  6. Smoke Test Impact Analysis: Determine if any changes could affect smoke tests by checking:
    • Changes to files/functions used by tests marked with @pytest.mark.smoke
    • Changes to fixtures or utilities imported by smoke tests
    • Changes to conftest.py files that may affect smoke test execution
    • Changes to core infrastructure code (utilities/, libs/) that smoke tests depend on

Your deliverable:
Your change request comment will be based on the following requirements:

Test Execution Plan

  • Run smoke tests: True / False (Based on your smoke test impact analysis - True if any changes may affect smoke tests)
  • path/to/test_file.py - When the entire test file needs verification
  • path/to/test_file.py::TestClass::test_method - When specific test(s) needed
  • path/to/test_file.py::test_function - When specific test(s) needed
  • -m marker - When specific marker(s) can be used to cover multiple cases.

Guidelines:

  • Include only tests directly affected by the changes
  • Use a full file path only if ALL tests in that file require verification
  • Use file path + test name if only specific tests are needed
  • If a test marker can cover multiple files/tests, provide the marker
  • Balance coverage vs over-testing - Keep descriptions minimal

Hardware-Related Checks (SR-IOV, GPU, DPDK):

When PR modifies fixtures for hardware-specific resources:

  • Collection Safety: Fixtures MUST have existence checks (return None when hardware unavailable)
  • Test Plan: MUST verify both WITH and WITHOUT hardware:
    • Run affected tests on cluster WITH hardware
    • Verify collection succeeds on cluster WITHOUT hardware

CRITICAL WORKFLOW COMPLETION RULES:

When responding to this test execution plan request, you MUST follow these rules EXACTLY:

  1. YOUR ONLY DELIVERABLE: Post an inline review comment containing the test execution plan on the first changed line
  2. THEN STOP IMMEDIATELY - Do NOT generate any additional response
  3. FALLBACK ONLY: If submitting the review fails after retrying, post as a regular PR comment
  4. SILENCE = SUCCESS: After successfully submitting the review, your task is complete. No confirmation needed.

ABSOLUTE PROHIBITIONS (violating these creates empty/meaningless reviews):

  • ❌ Do NOT post acknowledgment messages like "Test execution plan posted", "Review posted successfully", "I've successfully posted"
  • ❌ Do NOT mention review IDs, URLs, or confirmation of posting in the PR thread
  • ❌ Do NOT add any follow-up comments after submitting the review
  • ❌ Do NOT reply to confirm task completion
  • ❌ Do NOT explain what you did - just do it and stop

Remember: The pull request review is visible to users. Additional comments are redundant noise.

CRITICAL: Before setting "Run smoke tests: True", you MUST use shell scripts to:
- Trace the actual fixture dependency chain from smoke tests to changed fixtures
- Verify that smoke tests actually import/use changed utilities or functions
- Confirm the dependency path exists; do NOT assume based on scope or semantics
- Be conservative: Session-scoped fixtures or infrastructure-sounding names do NOT
automatically mean smoke test impact. Only flag smoke test impact when you can
demonstrate a concrete dependency path.
WRONG: "This session-scoped storage fixture might affect smoke tests"
RIGHT: "Smoke test X uses fixture Y, which depends on the changed fixture Z"

Comment thread tests/network/localnet/migration_stuntime/conftest.py
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
export GH_TOKEN="${GITHUB_TOKEN}"

echo "=== HEAD SHA ==="
HEAD_SHA=$(gh pr view 4833 --repo RedHatQE/openshift-virtualization-tests --json headRefOid --jq '.headRefOid')
echo "$HEAD_SHA"

echo "=== Smoke test dependency check ==="
SMOKE_FILES=$(rg -rl "pytest.mark.smoke" -g "*.py" tests/ 2>/dev/null)
if [ -n "$SMOKE_FILES" ]; then
  OVERLAP=$(echo "$SMOKE_FILES" | xargs grep -l "affinity\|liblocalnet\|libstuntime\|from libs\.vm\.spec\|from libs\.vm\.vm" 2>/dev/null)
  if [ -n "$OVERLAP" ]; then
    echo "OVERLAP FOUND: $OVERLAP"
  else
    echo "No overlap: smoke tests do not import changed modules"
  fi
else
  echo "No smoke-marked test files found"
fi

echo "=== PR files (first file + patch) ==="
gh api "repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files" \
  --jq '.[0] | {filename: .filename, patch: (.patch // "no patch")}' 2>&1 | head -30

echo "=== All changed filenames ==="
gh api "repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files" \
  --jq '.[].filename' 2>&1

echo "=== Post inline review comment ==="
python3 << 'PYEOF'
import json, os, ssl, urllib.request, urllib.error, subprocess

token = os.environ.get('GITHUB_TOKEN', '')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

# Get HEAD SHA
head_sha = subprocess.check_output(
    ["gh", "pr", "view", "4833", "--repo", "RedHatQE/openshift-virtualization-tests",
     "--json", "headRefOid", "--jq", ".headRefOid"],
    env={**os.environ, "GH_TOKEN": token}
).decode().strip()
print(f"HEAD SHA: {head_sha}")

# Get PR files
req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files",
    headers={"Authorization": f"token {token}", "Accept": "application/vnd.github.v3+json"}
)
try:
    with urllib.request.urlopen(req, timeout=30, context=ctx) as resp:
        files = json.loads(resp.read())
    print(f"Got {len(files)} files")
    first_file = files[0]
    first_filename = first_file['filename']
    patch = first_file.get('patch', '')
    print(f"First file: {first_filename}")

    # Find position of first added line
    position = 1
    if patch:
        lines = patch.split('\n')
        for i, line in enumerate(lines):
            if line.startswith('+') and not line.startswith('+++'):
                position = i + 1
                print(f"First added line pos={position}: {repr(line[:80])}")
                break
except Exception as e:
    print(f"Error getting files: {e}")
    first_filename = "libs/vm/affinity.py"
    position = 1

print(f"Posting to path={first_filename} position={position} sha={head_sha}")

comment_body = """**Test Execution Plan**

- **Run smoke tests: False** — Verified: no smoke-marked test file imports or depends on any changed module (`libs/vm/affinity.py`, `libs/vm/spec.py`, `libs/vm/vm.py`, `liblocalnet.py`, `libstuntime.py`). Dependency chain confirmed via codebase search.

- `tests/network/localnet/migration_stuntime/test_migration_stuntime.py` — Full file: all 12 tests (6 migration scenarios × `TestMigrationStuntimeIPv4` / `TestMigrationStuntimeIPv6`). Covers all changes: `ip_family` dependency added to `localnet_stuntime_server_vm` (forces VM recreation between IP families), `restarted_vms` fixture removed, `scope="class"` removed from `pytest.mark.parametrize`, `measure_stuntime()` helper, `CLIENT_VM_LABEL`/`SERVER_VM_LABEL` constants, and `new_pod_affinity`/`new_pod_anti_affinity` placement logic."""

payload = json.dumps({
    "commit_id": head_sha,
    "path": first_filename,
    "position": position,
    "body": comment_body
}).encode()

post_req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/comments",
    data=payload,
    method="POST",
    headers={
        "Authorization": f"token {token}",
        "Accept": "application/vnd.github.v3+json",
        "Content-Type": "application/json"
    }
)

try:
    with urllib.request.urlopen(post_req, timeout=30, context=ctx) as resp:
        result = json.loads(resp.read())
        print(f"SUCCESS: Comment ID={result.get('id')} on path={result.get('path')} pos={result.get('position')}")
except urllib.error.HTTPError as e:
    body = e.read().decode()
    print(f"HTTP ERROR {e.code}: {body[:500]}")
except Exception as ex:
    print(f"ERROR: {ex}")
PYEOF

Length of output: 5757


🏁 Script executed:

#!/bin/bash
echo "=== HEAD SHA via git ==="
HEAD_SHA=$(git rev-parse HEAD)
echo "$HEAD_SHA"

echo "=== Changed files ==="
git diff origin/main...HEAD --name-only | head -10

echo "=== First changed file patch ==="
FIRST_FILE=$(git diff origin/main...HEAD --name-only | head -1)
echo "First file: $FIRST_FILE"
git diff origin/main...HEAD -- "$FIRST_FILE" | head -20

echo "=== Post inline review comment via curl ==="
python3 << 'PYEOF'
import json, os, ssl, urllib.request, urllib.error, subprocess

token = os.environ.get('GITHUB_TOKEN', '')
if not token:
    print("ERROR: GITHUB_TOKEN not set")
    exit(1)

ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

# Get HEAD SHA via git
head_sha = subprocess.check_output(["git", "rev-parse", "HEAD"]).decode().strip()
print(f"HEAD SHA: {head_sha}")

# Get first changed file and patch position via git
diff_files = subprocess.check_output(
    ["git", "diff", "origin/main...HEAD", "--name-only"]
).decode().strip().split('\n')
print(f"Changed files: {diff_files}")
first_filename = diff_files[0]
print(f"First file: {first_filename}")

# Get patch for first file to find first added line position
diff_output = subprocess.check_output(
    ["git", "diff", "origin/main...HEAD", "--", first_filename]
).decode()
lines = diff_output.split('\n')
position = 1
for i, line in enumerate(lines):
    if line.startswith('@@'):
        # Start counting positions from 1 after the @@ line
        for j, l in enumerate(lines[i+1:], start=i+2):
            if l.startswith('+') and not l.startswith('+++'):
                position = j - i  # relative position within the hunk
                print(f"First added line: {repr(l[:80])} at hunk-relative pos={position}")
                break
        break

# Use position=1 as the first line of the diff (hunk header counts as position 1)
# The first actual changed line is position 2+
print(f"Using position: {position}")

comment_body = """**Test Execution Plan**

- **Run smoke tests: False** — Verified: no smoke-marked test file imports or depends on any changed module (`libs/vm/affinity.py`, `libs/vm/spec.py`, `libs/vm/vm.py`, `liblocalnet.py`, `libstuntime.py`). Dependency chain confirmed via codebase search.

- `tests/network/localnet/migration_stuntime/test_migration_stuntime.py` — Full file: all 12 tests (6 migration scenarios × `TestMigrationStuntimeIPv4` / `TestMigrationStuntimeIPv6`). Covers all changes: `ip_family` dependency added to `localnet_stuntime_server_vm` (forces VM recreation between IP families), `restarted_vms` fixture removed, `scope="class"` removed from `pytest.mark.parametrize`, `measure_stuntime()` helper, `CLIENT_VM_LABEL`/`SERVER_VM_LABEL` constants, and `new_pod_affinity`/`new_pod_anti_affinity` placement logic."""

payload = json.dumps({
    "commit_id": head_sha,
    "path": first_filename,
    "position": position,
    "body": comment_body
}).encode()

post_req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/comments",
    data=payload,
    method="POST",
    headers={
        "Authorization": f"token {token}",
        "Accept": "application/vnd.github.v3+json",
        "Content-Type": "application/json"
    }
)

try:
    with urllib.request.urlopen(post_req, timeout=30, context=ctx) as resp:
        result = json.loads(resp.read())
        print(f"SUCCESS: Comment ID={result.get('id')} on path={result.get('path')} pos={result.get('position')}")
except urllib.error.HTTPError as e:
    body = e.read().decode()
    print(f"HTTP ERROR {e.code}: {body[:500]}")
except Exception as ex:
    print(f"ERROR: {ex}")
PYEOF

Length of output: 4353


🏁 Script executed:

#!/bin/bash
echo "=== HEAD SHA ==="
git rev-parse HEAD

echo "=== Available token env vars ==="
env | grep -i "token\|auth\|secret\|cred" | sed 's/=.*/=REDACTED/' || echo "none found"

echo "=== Git log recent commits ==="
git log --oneline -5

echo "=== Changed files in last commit ==="
git show --name-only --format="" HEAD | head -20

echo "=== Changed files in last 5 commits vs merge-base ==="
git diff HEAD~5...HEAD --name-only 2>/dev/null | head -20 || echo "fallback failed"

echo "=== Try git diff with first parent ==="
git diff HEAD^1...HEAD --name-only 2>/dev/null | head -20 || echo "fallback"

echo "=== Files changed across recent commits ==="
git log --name-only --format="" -5 | grep -v "^$" | sort -u | head -20

Length of output: 2529


🏁 Script executed:

#!/bin/bash
python3 << 'PYEOF'
import json, os, ssl, urllib.request, urllib.error

token = os.environ.get('GH_TOKEN', '')
if not token:
    print("ERROR: GH_TOKEN not set")
    exit(1)

ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

head_sha = "2a20af4a97bd5ecd895701bbcf1ecd71aea75276"
print(f"HEAD SHA: {head_sha}")

# Get PR files
req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/files",
    headers={"Authorization": f"token {token}", "Accept": "application/vnd.github.v3+json"}
)
try:
    with urllib.request.urlopen(req, timeout=30, context=ctx) as resp:
        files = json.loads(resp.read())
    print(f"Got {len(files)} files")
    for i, f in enumerate(files):
        print(f"FILE {i}: {f['filename']}")
    
    first_file = files[0]
    first_filename = first_file['filename']
    patch = first_file.get('patch', '')
    print(f"\nFirst file: {first_filename}")
    print(f"Patch (first 300 chars): {patch[:300]}")

    # Find position of first added line in the diff
    # GitHub PR review comment position: 1-indexed line in the unified diff
    # Position 1 = first line (hunk header @@...)
    # Each subsequent line increments position
    position = 1
    if patch:
        lines = patch.split('\n')
        for i, line in enumerate(lines):
            if line.startswith('+') and not line.startswith('+++'):
                position = i + 1  # 1-indexed
                print(f"First added line at position {position}: {repr(line[:80])}")
                break
    print(f"Using position: {position}")

except Exception as e:
    print(f"Error getting files: {e}")
    exit(1)

comment_body = """**Test Execution Plan**

- **Run smoke tests: False** — Verified: no smoke-marked test file imports or depends on any changed module (`libs/vm/affinity.py`, `libs/vm/spec.py`, `libs/vm/vm.py`, `liblocalnet.py`, `libstuntime.py`). Dependency chain confirmed via codebase search.

- `tests/network/localnet/migration_stuntime/test_migration_stuntime.py` — Full file: all 12 tests (6 migration scenarios × `TestMigrationStuntimeIPv4` / `TestMigrationStuntimeIPv6`). Covers all changes: `ip_family` dependency added to `localnet_stuntime_server_vm` (forces VM recreation between IP families), `restarted_vms` fixture removed, `scope="class"` removed from `pytest.mark.parametrize`, `measure_stuntime()` helper, `CLIENT_VM_LABEL`/`SERVER_VM_LABEL` constants, and `new_pod_affinity`/`new_pod_anti_affinity` placement logic."""

payload = json.dumps({
    "commit_id": head_sha,
    "path": first_filename,
    "position": position,
    "body": comment_body
}).encode()

post_req = urllib.request.Request(
    "https://api.github.com/repos/RedHatQE/openshift-virtualization-tests/pulls/4833/comments",
    data=payload,
    method="POST",
    headers={
        "Authorization": f"token {token}",
        "Accept": "application/vnd.github.v3+json",
        "Content-Type": "application/json"
    }
)

try:
    with urllib.request.urlopen(post_req, timeout=30, context=ctx) as resp:
        result = json.loads(resp.read())
        print(f"SUCCESS: Comment ID={result.get('id')} on path={result.get('path')} pos={result.get('position')}")
except urllib.error.HTTPError as e:
    body = e.read().decode()
    print(f"HTTP ERROR {e.code}: {body[:500]}")
except Exception as ex:
    print(f"ERROR: {ex}")
PYEOF

Length of output: 4418



Test Execution Plan

  • Run smoke tests: False — Verified: no smoke-marked test file imports or depends on any changed module (libs/vm/affinity.py, libs/vm/spec.py, libs/vm/vm.py, liblocalnet.py, libstuntime.py). Dependency chain confirmed via codebase search.

  • tests/network/localnet/migration_stuntime/test_migration_stuntime.py — Full file: all 12 tests (6 migration scenarios × TestMigrationStuntimeIPv4 / TestMigrationStuntimeIPv6). Covers all changes: ip_family dependency added to localnet_stuntime_server_vm (forces VM recreation between IP families), restarted_vms fixture removed, scope="class" removed from pytest.mark.parametrize, measure_stuntime() helper, CLIENT_VM_LABEL/SERVER_VM_LABEL constants, and new_pod_affinity/new_pod_anti_affinity placement logic.

Copy link
Copy Markdown
Collaborator

@rnetser rnetser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 26, 2026

/check-can-merge

2 similar comments
@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 27, 2026

/check-can-merge

@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 27, 2026

/check-can-merge

Implement the remaining stuntime measurement tests for OVN localnet live
migration, covering all client/server migration directions with IPv4/IPv6.

Single parametrized class with class-level ip_family parametrize to
group all scenarios per IP family before moving to the next. VMs depend
on ip_family so they're recreated per group, giving each IP family
fresh VMs with clean network state. Tests run incrementally within each
group, each migration building on the VM positions left by the previous
scenario.

Each test has a single Polarion ID shared across both IP families.

Signed-off-by: Anat Wax <awax@redhat.com>
Assisted-by: Claude <noreply@anthropic.com>
@Anatw
Copy link
Copy Markdown
Contributor Author

Anatw commented May 27, 2026

Change: rebase on main

@openshift-virtualization-qe-bot
Copy link
Copy Markdown

Clean rebase detected — no code changes compared to previous head (2a20af4).
The following labels were preserved: verified, commented-Anatw, lgtm-rnetser, commented-coderabbitai[bot], approved-rnetser, lgtm-servolkov, lgtm-coderabbitai[bot].

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

Successfully removed PR tag: quay.io/openshift-cnv/openshift-virtualization-tests:pr-4833.

@openshift-virtualization-qe-bot-3
Copy link
Copy Markdown
Contributor

New container for quay.io/openshift-cnv/openshift-virtualization-tests:latest published

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants