Skip to content

Tests for Satellite with local Insights Advisor#17342

Merged
tpapaioa merged 1 commit intoSatelliteQE:masterfrom
tpapaioa:satellite_local_advisor_engine
Mar 10, 2025
Merged

Tests for Satellite with local Insights Advisor#17342
tpapaioa merged 1 commit intoSatelliteQE:masterfrom
tpapaioa:satellite_local_advisor_engine

Conversation

@tpapaioa
Copy link
Contributor

@tpapaioa tpapaioa commented Jan 15, 2025

Problem Statement

Need to add testing for Satellite w/ local Insights advisor engine.

Solution

  • Create new pytest fixture, module_target_sat_insights. By default, or if it is parametrized with a True value, it will yield module_target_sat, which is configured to use hosted Insights to upload client data to Inventory and syncs recommendations from advisor. If the fixture is parametrized with a False value, then it will deploy a new Satellite and configure it to use the local advisor engine. Note: this requires some additional steps, to add the advisor rules to the engine once it's installed. These steps can be added to the new settings.rh_cloud.iop_setup_script settings, e.g.,
rh_cloud:
  iop_advisor_image: ''
  iop_setup_script: |
    git clone RULES_REPO
    cd iop-advisor-engine-content/ && ./generate_static.sh && mv static/ /etc/iop-advisor-engine/
    sed -i "/FOREMAN_URL/aEnvironment = RULES_COMPONENTS='telemetry.rules.plugins,prodsec.rules'" /etc/containers/systemd/iop-advisor-engine.container
    sed -i "/FOREMAN_URL/aVolume = /etc/iop-advisor-engine/static:/opt/app-root/src/static:z" /etc/containers/systemd/iop-advisor-engine.container
    systemctl daemon-reload
    systemctl restart iop-advisor-engine.service

See SAT-30174 for further details.

  • Update the other fixtures in pytest_fixtures/component/rh_cloud.py to use module_target_sat_insights.
  • Parametrize the existing advisor-related UI tests to use the new fixture, parametrized to run for both hosted and local Insights. Update the tests so that inventory and recommendations sync are performed only when the Satellite uses hosted Insights.
  • Add test_rhcloud_inventory_disabled_local_insights test to verify that the Inventory Upload page is disabled when the local advisor engine is enabled. Because the other inventory tests are relevant only for hosted Insights, I haven't modified them, and they continue to use the module_target_sat fixture.
  • Add local_advisor_engine_enabled property method to the Satellite class, to read the Satellite API and return a boolean indicating whether the local advisor is enabled (True) or not (False).

Related Issues

SAT-30174

PRT

See PRT result below.

@tpapaioa tpapaioa added No-CherryPick PR doesnt need CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master labels Jan 15, 2025
@tpapaioa tpapaioa self-assigned this Jan 15, 2025
@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch 5 times, most recently from 11045b2 to 44b6904 Compare January 21, 2025 03:21
@tpapaioa tpapaioa changed the title Satellite IOP Tests for Satellite with local Insights Advisor Jan 21, 2025
@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch 3 times, most recently from 192f93b to 582c5f2 Compare January 22, 2025 19:02
@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch 3 times, most recently from 2150bdf to 2e01c89 Compare February 11, 2025 18:59
@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch 3 times, most recently from f075a5d to 3d0951f Compare February 15, 2025 15:03
@tpapaioa tpapaioa marked this pull request as ready for review February 15, 2025 16:07
@tpapaioa tpapaioa requested a review from a team February 15, 2025 16:07
@tpapaioa tpapaioa requested a review from a team as a code owner February 15, 2025 16:07
@tpapaioa tpapaioa marked this pull request as draft February 15, 2025 16:07
@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch 5 times, most recently from 9b5f0eb to 8787031 Compare February 19, 2025 17:36
@tpapaioa tpapaioa marked this pull request as ready for review February 19, 2025 20:35
@tpapaioa tpapaioa added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 19, 2025
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10244
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_rhcloud_insights.py tests/foreman/ui/test_rhcloud_inventory.py -k local or hosted --external-logging
Test Result: ======== 21 passed, 26 deselected, 2071 warnings in 11853.04s (3:17:33) ========

@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch from 8787031 to 5c9aa70 Compare February 24, 2025 17:45
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 24, 2025
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 10347
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_rhcloud_insights.py tests/foreman/ui/test_rhcloud_inventory.py -k hosted or local 
Test Result: ======== 21 passed, 26 deselected, 2178 warnings in 12562.14s (3:29:22) ========

@SatelliteQE SatelliteQE deleted a comment from Satellite-QE Feb 27, 2025
@tpapaioa tpapaioa added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 27, 2025
@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch from 5c9aa70 to a830476 Compare February 27, 2025 23:59
@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 28, 2025
Copy link
Member

@ColeHiggins2 ColeHiggins2 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@ColeHiggins2
Copy link
Member

@jeremylenz Mind taking a look as well?

Copy link
Contributor

@jeremylenz jeremylenz left a comment

Choose a reason for hiding this comment

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

LGTM, just one wording suggestion below

@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch 2 times, most recently from 0555ab2 to dcfe752 Compare February 28, 2025 22:01
@tpapaioa tpapaioa added 6.17.z CherryPick PR needs CherryPick to previous branches and removed No-CherryPick PR doesnt need CherryPick to previous branches labels Mar 3, 2025
@tpapaioa tpapaioa force-pushed the satellite_local_advisor_engine branch from dcfe752 to efd6838 Compare March 7, 2025 18:30
@SatelliteQE SatelliteQE deleted a comment from Satellite-QE Mar 10, 2025
@tpapaioa tpapaioa merged commit 50072cc into SatelliteQE:master Mar 10, 2025
9 checks passed
@tpapaioa tpapaioa deleted the satellite_local_advisor_engine branch March 10, 2025 15:10
github-actions bot pushed a commit that referenced this pull request Mar 10, 2025
Local Insights advisor testing

(cherry picked from commit 50072cc)
vsedmik pushed a commit that referenced this pull request Mar 11, 2025
Tests for Satellite with local Insights Advisor (#17342)

Local Insights advisor testing

(cherry picked from commit 50072cc)

Co-authored-by: Tasos Papaioannou <tpapaioa@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.17.z CherryPick PR needs CherryPick to previous branches Stream Introduced in or relating directly to Satellite Stream/Master

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants