[cnv-4.19] Add marker for class/module scoped data collection (#4118)#4293
Conversation
…QE#4118) Add marker for class/module scoped data collection Add 5-minute buffer to prevent data gaps in must-gather. Introduces a new @pytest.mark.data_collector_scope("module") marker that enables module-level data collection timing. When applied to a test file, all must-gather/log collection will use the timestamp from the first test in the module instead of individual test timestamps. Add a 5-minute buffer because must-gather runs multiple `oc adm inspect` commands with the same `--since`, while 1.5-2 minutes may pass between them. Changes: - Add data_collector_scope marker to pytest.ini - Add Database.insert_module_start_time() to track first test in module - Add Database.get_module_start_time() to retrieve module start time - Update pytest_runtest_setup to check for marker and store module time - Update pytest_exception_interact to use module time when marker present - Add comprehensive unit tests for new database methods Example: test_machinetype.py has class-scoped vm_for_machine_type_test fixture. With the marker, if test_machine_type_after_vm_migrate fails, logs are collected from when the first test ran (when the VM was created), not just from the failing test start time. This solves the issue where class-scoped fixtures create resources (like VMs) during the first test, but later test failures only collect logs from that specific test, missing earlier logs. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> <!-- full-ticket-url needs to be provided. This would add a link to the pull request to the jira and close it when the pull request is merged If the task is not tracked by a Jira ticket, just write "NONE". --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **New Features** * Configurable data-collection scope via a pytest marker, applied module-wide across many test modules. * Must-gather timer now includes a 5-minute buffer when a test start time is available. * **Bug Fixes / Reliability** * Safer start-time storage/retrieval with guards and unified error-aware handling; improved diagnostic log prefixes. * **Tests** * Unit tests updated to cover start-time insert/retrieval and missing-entry behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
|
/build-and-push-container |
|
New container for quay.io/openshift-cnv/openshift-virtualization-tests:pr-4293 published |
manual cherry-pick, original PR: #4118