Engg. Hygiene: Introduce Extension Status Asserter and use in example Test class#352
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a reusable ExtStatusAsserter helper for unit tests to validate extension status/substatus output by substatus name (not array position), and updates the ConfigurePatching processor tests to use these deterministic assertions instead of brittle index-based checks.
Changes:
- Added
ExtStatusAssertertest utility to load the status file once and provide higher-level assertion helpers (substatus, errors, patch presence, metadata). - Refactored portions of
Test_ConfigurePatchingProcessorto use the new asserter rather than hard-coded substatus ordering. - Minor logging/documentation tweaks in core logic (
ConfigurePatchingProcessor,ServiceManager).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| src/core/tests/Test_ConfigurePatchingProcessor.py | Replaces index-based status-file assertions with ExtStatusAsserter calls in several tests. |
| src/core/tests/library/ExtStatusAsserter.py | New helper implementing status/substatus parsing and assertion APIs for tests. |
| src/core/src/core_logic/ServiceManager.py | Adds a short docstring to remove_service(). |
| src/core/src/core_logic/ConfigurePatchingProcessor.py | Adds log prefixes/verbose logs and introduces a cleanup helper method (currently unused). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #352 +/- ##
==========================================
+ Coverage 93.99% 94.04% +0.04%
==========================================
Files 107 109 +2
Lines 19810 19967 +157
==========================================
+ Hits 18621 18778 +157
Misses 1189 1189
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Do we have a work item for improving the noted test? |
This release contains: - Fix: [UT fix] Fixing DNF5/AzL4 UTs failing in Py2.7 [354](#354) - Feature: [Ubuntu, no-CVM] Use default repo for UEFI and kek certificate updates [351](#351) - Engg. Hygiene: Introduce Extension Status Asserter and use in example Test class [352](#352) - Feature: Updated LPE Packager with Auto-version update publish support + misc. improvements [313](#313)
Test harness improvement to allow unit tests to deterministically check extension status.
In this PR:
- Extensible beyond this
Future changes:
All code authors can rely on this for new tests.
Existing tests may be rewritten as a new-hire exercise.
(Note: This was previously bundled into the commit history of https://github.com/Azure/LinuxPatchExtension/pull/313/changes - moved it out separately as good practice)