Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test CV incremental update & publish time #14749

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

damoore044
Copy link
Contributor

@damoore044 damoore044 commented Apr 11, 2024

Problem Statement

Implement backlogged desired coverage - PR #9991 , authored by @latran

Solution

  • Automation for incremental update duration coverage, for BZ 2117760 and BZ 1829266

  • Steps:

    • On an existing CV with decent amount of content, perform incremental update with only one errata.
    • Publish the entire content view.
    • Expect: The duration of the incremental update should almost always be shorter than the CV publish. To cover the BZs fully, if the update does take longer, check that it was close, that update did not take significantly longer.
  • Original issue raised in BZs: CV publish would only take a few minutes as expected, but incremental update with one or a couple errata was taking over an hour.

  • timeout (to catch any future performance degradation) - for incr. update is 20 seconds,
    for publish of CV timeout is 30 seconds, based on prt performance.
    Includes logging duration for both incr. update and cv publish.

PRT case

trigger: test-robottelo
pytest: tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time

@damoore044 damoore044 added the Stream Introduced in or relating directly to Satellite Stream/Master label Apr 11, 2024
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6469
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time --external-logging
Test Result : ================== 1 passed, 11 warnings in 989.35s (0:16:29) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 11, 2024
@damoore044 damoore044 changed the title Test incremental update time Test CV incremental update & publish time Apr 11, 2024
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 11, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6470
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time --external-logging
Test Result : ================= 1 passed, 11 warnings in 1048.82s (0:17:28) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 11, 2024
@damoore044 damoore044 added CherryPick PR needs CherryPick to previous branches 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 labels Apr 12, 2024
@damoore044 damoore044 marked this pull request as ready for review April 12, 2024 11:49
@damoore044 damoore044 requested a review from a team as a code owner April 12, 2024 11:49
Comment on lines 235 to 267
# rhel8 base os
rhel8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhel8_bos']['name'],
reposet=REPOSET['rhel8_bos'],
releasever=REPOS['rhel8_bos']['releasever'],
)
rhel8_repo = module_target_sat.api.Repository(id=rhel8_repo_id).read()
assert rhel8_repo.sync(timeout=3000)['result'] == 'success'
# rh sat tools
rhst8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhst8']['name'],
reposet=REPOSET['rhst8'],
releasever=None,
)
rhst8_repo = module_target_sat.api.Repository(id=rhst8_repo_id).read()
assert rhst8_repo.sync()['result'] == 'success'
# rh sat client
rhsc8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhsclient8']['name'],
reposet=REPOSET['rhsclient8'],
releasever=None,
)
rhsc8_repo = module_target_sat.api.Repository(id=rhsc8_repo_id).read()
assert rhsc8_repo.sync()['result'] == 'success'
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to loop through these for repo in ['rhel8_bos', 'rhst8', 'rhsclient8']. Or if you want to write a helper function that works too.

Copy link
Contributor

Choose a reason for hiding this comment

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

May be, writing separate fixtures can be good way for this test module, this could reuse in any new additional test case.
btw there is an existing fixture for Satellite client repo for RHEL7 (sat_client_repo) and can be use instead of rhsclient8

Copy link
Contributor

Choose a reason for hiding this comment

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

We could also .sync(synchronous=False) to make the test faster (since the syncs would run in parallel) and do wait_for_task to ensure they succeeded.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vsedmik agree with synch(synchronous=False), the lastest push includes the 3 repos in loop being added to CV and then sync started. Then we wait for repo sync tasks, poll succeeds, then perform incremental testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Griffin-Sullivan @vijaysawant for the implementation of a fixture, I didn't plan to use these repositories often,
do we think a fixture would be needed for just this case ?
For Griffin's recommendation, looping just once through the repo_ids, latest push has this refactored.
Let me know how the changes look!

Copy link
Member

Choose a reason for hiding this comment

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

@Griffin-Sullivan Are you fine with the changes? Can we resolve this thread?

Comment on lines 269 to 267
cv = module_target_sat.cli_factory.make_content_view(
{'organization-id': module_sca_manifest_org.id}
)
rhel_repos = [rhst8_repo_id, rhsc8_repo_id, rhel8_repo_id]
for repo_id in rhel_repos:
module_target_sat.cli.ContentView.add_repository(
{
'id': cv['id'],
'organization-id': module_sca_manifest_org.id,
'repository-id': repo_id,
}
)
Copy link
Contributor

Choose a reason for hiding this comment

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

If you add the loop I described above you could actually:

  1. make the CV
  2. Loop through each repo, sync, then add it to the CV

timeout = 120 # seconds
start_time = datetime.utcnow() - timedelta(seconds=1)
result = module_target_sat.cli.ContentView.version_incremental_update(
{'content-view-version-id': cvv['id'], 'errata-ids': 'RHSA-2023:5982'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any way we can fetch this errata-id from somewhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

Get the applicable errata reference from same file

errata_list = get_applicable_errata(<any repository object>)
...
errata_id = errata_list[0].id

Copy link
Contributor Author

@damoore044 damoore044 Apr 12, 2024

Choose a reason for hiding this comment

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

We don't need this specific errata_id, I think we could also use existing REAL_RHEL8_1_ERRATA_ID -
RHSA-2022:4867

)
assert 'version-1.1' in str(result[0].keys())
module_target_sat.cli.ContentView.publish({'id': cv['id']})
assert (datetime.utcnow() - timedelta(seconds=1)) - start_time <= timedelta(seconds=timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it just the incremental update we want to take less than 120 seconds? Right now this is coded for the incremental update and the publish afterwards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right the original BZs mentioned a difference in the time to publish, and the time to promote.
Do you think it's worth checking time for both publish and promote of incremental version, separately asserting both durations?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd stick to the BZ (inc-update + publish).

Copy link
Contributor

@vijaysawant vijaysawant left a comment

Choose a reason for hiding this comment

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

Please look over pending comments and resolve conversation.
Suggested changes can be implemented.
Otherwise everything looks good.

Comment on lines 235 to 267
# rhel8 base os
rhel8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhel8_bos']['name'],
reposet=REPOSET['rhel8_bos'],
releasever=REPOS['rhel8_bos']['releasever'],
)
rhel8_repo = module_target_sat.api.Repository(id=rhel8_repo_id).read()
assert rhel8_repo.sync(timeout=3000)['result'] == 'success'
# rh sat tools
rhst8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhst8']['name'],
reposet=REPOSET['rhst8'],
releasever=None,
)
rhst8_repo = module_target_sat.api.Repository(id=rhst8_repo_id).read()
assert rhst8_repo.sync()['result'] == 'success'
# rh sat client
rhsc8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhsclient8']['name'],
reposet=REPOSET['rhsclient8'],
releasever=None,
)
rhsc8_repo = module_target_sat.api.Repository(id=rhsc8_repo_id).read()
assert rhsc8_repo.sync()['result'] == 'success'
Copy link
Contributor

Choose a reason for hiding this comment

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

May be, writing separate fixtures can be good way for this test module, this could reuse in any new additional test case.
btw there is an existing fixture for Satellite client repo for RHEL7 (sat_client_repo) and can be use instead of rhsclient8

timeout = 120 # seconds
start_time = datetime.utcnow() - timedelta(seconds=1)
result = module_target_sat.cli.ContentView.version_incremental_update(
{'content-view-version-id': cvv['id'], 'errata-ids': 'RHSA-2023:5982'}
Copy link
Contributor

Choose a reason for hiding this comment

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

Get the applicable errata reference from same file

errata_list = get_applicable_errata(<any repository object>)
...
errata_id = errata_list[0].id

Copy link
Contributor

@vsedmik vsedmik left a comment

Choose a reason for hiding this comment

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

Pending @Griffin-Sullivan's good suggestion, otherwise looks good.

Comment on lines 235 to 267
# rhel8 base os
rhel8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhel8_bos']['name'],
reposet=REPOSET['rhel8_bos'],
releasever=REPOS['rhel8_bos']['releasever'],
)
rhel8_repo = module_target_sat.api.Repository(id=rhel8_repo_id).read()
assert rhel8_repo.sync(timeout=3000)['result'] == 'success'
# rh sat tools
rhst8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhst8']['name'],
reposet=REPOSET['rhst8'],
releasever=None,
)
rhst8_repo = module_target_sat.api.Repository(id=rhst8_repo_id).read()
assert rhst8_repo.sync()['result'] == 'success'
# rh sat client
rhsc8_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel8'],
repo=REPOS['rhsclient8']['name'],
reposet=REPOSET['rhsclient8'],
releasever=None,
)
rhsc8_repo = module_target_sat.api.Repository(id=rhsc8_repo_id).read()
assert rhsc8_repo.sync()['result'] == 'success'
Copy link
Contributor

Choose a reason for hiding this comment

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

We could also .sync(synchronous=False) to make the test faster (since the syncs would run in parallel) and do wait_for_task to ensure they succeeded.

Comment on lines 287 to 288
timeout = 120 # seconds
start_time = datetime.utcnow() - timedelta(seconds=1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Btw, what is the current inc-update + publish time? Does the 120s have a safe margin?
Also wanted to ask about the timedelta(seconds=1) purpose. Some rounding?

Copy link
Contributor Author

@damoore044 damoore044 Apr 12, 2024

Choose a reason for hiding this comment

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

Locally I get about 10 seconds to update/create incremental version, and maybe 15-20 seconds to publish.
*edit- avg times reflect most recent testing/logging

I will add some logging output of the time, and per @Griffin-Sullivan suggestion, think we should track the duration of each, incremental update & publish, individually.
^ Done

As for timedelta rounding, I find this works best for asserting some satellite task time started on or after.
It's not looking for any tasks yet so wasn't quite needed, but the next push will find and wait_for_tasks.

)
assert 'version-1.1' in str(result[0].keys())
module_target_sat.cli.ContentView.publish({'id': cv['id']})
assert (datetime.utcnow() - timedelta(seconds=1)) - start_time <= timedelta(seconds=timeout)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd stick to the BZ (inc-update + publish).

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 12, 2024
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6492
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time --external-logging
Test Result : ================= 1 passed, 14 warnings in 1123.09s (0:18:43) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 12, 2024
Copy link
Contributor

@Griffin-Sullivan Griffin-Sullivan left a comment

Choose a reason for hiding this comment

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

If PRT passes I'm good with this. Nice work!

tests/foreman/longrun/test_inc_updates.py Show resolved Hide resolved
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6523
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time --external-logging
Test Result : ================== 1 passed, 14 warnings in 964.66s (0:16:04) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 16, 2024
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 16, 2024
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6532
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time --external-logging
Test Result : ================= 1 passed, 14 warnings in 1034.16s (0:17:14) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 16, 2024
@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6534
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time --external-logging
Test Result : ================== 1 passed, 14 warnings in 998.03s (0:16:38) ==================

@Satellite-QE Satellite-QE removed the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 17, 2024
@damoore044
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 6537
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/longrun/test_inc_updates.py::test_positive_incremental_update_time --external-logging
Test Result : ================= 1 passed, 14 warnings in 1014.44s (0:16:54) ==================

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Apr 17, 2024
Copy link
Member

@jyejare jyejare left a comment

Choose a reason for hiding this comment

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

ACK pending question.

tests/foreman/longrun/test_inc_updates.py Show resolved Hide resolved
@lpramuk lpramuk merged commit 11858fa into SatelliteQE:master Apr 17, 2024
11 checks passed
github-actions bot pushed a commit that referenced this pull request Apr 17, 2024
Test incremental update time

(cherry picked from commit 11858fa)
jyejare pushed a commit to jyejare/robottelo that referenced this pull request Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR Stream Introduced in or relating directly to Satellite Stream/Master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants