[6.17.z] Fix Discovery provisioning tests - #21061
Closed
Satellite-QE wants to merge 1 commit into
Closed
Conversation
* Fix Discovery provisioning tests * Apply SAT-33477 workaround to UI tests (cherry picked from commit 9ff92d0)
Collaborator
Author
|
Contributor
Reviewer's GuideAdjusts discovery host provisioning tests to handle an open bug around missing org/location assignments, cleans discovery hosts before discovery provisioning, and relies on provisioning flow rather than direct field mutation in API tests. Sequence diagram for discovery provisioning test flow with dhcpd restart and host cleanupsequenceDiagram
actor Tester
participant Pytest as pytest_runner
participant Fixture as module_provisioning_sat
participant Sat as sat_instance
participant API as sat_api
participant DHCP as dhcpd_service
Tester->>Pytest: run discovery_provisioning_tests
Pytest->>Fixture: module_provisioning_sat(provisioning_type=discovery)
Fixture->>Sat: configure_discovery_settings()
Fixture->>Sat: build_PXE_templates()
Note over Fixture,API: New behavior: clean preexisting discovered hosts
Fixture->>API: DiscoveredHost().search()
API-->>Fixture: list of discovered_hosts
loop for each discovered_host
Fixture->>API: discovered_host.delete()
API-->>Fixture: delete_result
end
alt sat.network_type == IPV4
Fixture->>Sat: execute(cat /dev/null > /var/lib/dhcpd/dhcpd.leases)
Sat-->>Fixture: status 0
Fixture->>Sat: execute(systemctl restart dhcpd)
Sat-->>Fixture: status 0
Sat->>DHCP: restart
DHCP-->>Sat: ready_with_fresh_config
end
Fixture-->>Pytest: satellite_ready_for_discovery
Pytest->>Sat: boot_discovery_VM()
Sat->>DHCP: serve_PXE_config_for_discovery
DHCP-->>Sat: correct_discovery_boot_files
Sat-->>Pytest: discovered_hosts_created
Pytest-->>Tester: tests_pass
Flow diagram for module_provisioning_sat discovery provisioning preparationflowchart TD
A[start module_provisioning_sat] --> B[Create hostgroup with provisioning settings]
B --> C{provisioning_type == discovery?}
C -- No --> E{sat.network_type == IPV4?}
C -- Yes --> D[Search all DiscoveredHost via API]
D --> D1[Iterate discovered_hosts]
D1 --> D2[Call delete on each discovered_host]
D2 --> E{sat.network_type == IPV4?}
E -- No --> G[Return satellite_ready_for_provisioning]
E -- Yes --> F[Clear /var/lib/dhcpd/dhcpd.leases and restart dhcpd]
F --> G[Return satellite_ready_for_provisioning]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The SAT-33477 workaround logic in both
test_positive_custom_provision_pxe_hostandtest_positive_auto_provision_host_with_ruleis duplicated; consider extracting a small helper to assign organization/location to a discovered host to keep the tests easier to maintain. - In
module_provisioning_sat, deleting all discovered hosts whenprovisioning_type == 'discovery'is a fairly broad side effect for a fixture; consider narrowing the deletion to the hosts created by this fixture or clearly scoping when this cleanup happens to avoid surprising interactions with other tests.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The SAT-33477 workaround logic in both `test_positive_custom_provision_pxe_host` and `test_positive_auto_provision_host_with_rule` is duplicated; consider extracting a small helper to assign organization/location to a discovered host to keep the tests easier to maintain.
- In `module_provisioning_sat`, deleting all discovered hosts when `provisioning_type == 'discovery'` is a fairly broad side effect for a fixture; consider narrowing the deletion to the hosts created by this fixture or clearly scoping when this cleanup happens to avoid surprising interactions with other tests.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
This pull request has not been updated in the past 45 days. |
Member
|
Hey @archanaserver, this cherry-pick PR has a PRT failure. Could you take a look and let us know if it's ready to merge despite the failure? |
|
This pull request has not been updated in the past 45 days. |
|
This pull request is now being closed after stale warnings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherrypick of PR: #20638
Problem Statement
Discovery provisioning tests are failing because
dhcpdis not restarted after building PXE templates in themodule_discovery_satfixture. Without the restart, dhcpd serves old cached configuration.Solution
Added
dhcpdservice restart in themodule_discovery_satfixture after all discovery configuration is complete. This ensures dhcpd picks up the updated PXE boot configuration and serves the correct discovery boot files to VMs.Related Issues
Fixes: SAT-39920
Summary by Sourcery
Adjust discovery host provisioning tests and fixtures to handle discovery-specific preconditions and avoid relying on deprecated host assignment paths.
Bug Fixes:
Tests: