-
Notifications
You must be signed in to change notification settings - Fork 115
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
Conversation
trigger: test-robottelo |
PRT Result
|
c458337
to
a11c399
Compare
trigger: test-robottelo |
PRT Result
|
# 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' |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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?
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, | ||
} | ||
) |
There was a problem hiding this comment.
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:
- make the CV
- 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'} |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this 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.
# 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' |
There was a problem hiding this comment.
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'} |
There was a problem hiding this comment.
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
There was a problem hiding this 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.
# 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' |
There was a problem hiding this comment.
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.
timeout = 120 # seconds | ||
start_time = datetime.utcnow() - timedelta(seconds=1) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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).
a11c399
to
6a60b92
Compare
trigger: test-robottelo |
6a60b92
to
87edf52
Compare
PRT Result
|
There was a problem hiding this 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!
PRT Result
|
1985aad
to
df22692
Compare
trigger: test-robottelo |
df22692
to
06486b8
Compare
trigger: test-robottelo |
PRT Result
|
PRT Result
|
06486b8
to
c57b26a
Compare
trigger: test-robottelo |
PRT Result
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK pending question.
Test incremental update time (cherry picked from commit 11858fa)
Test incremental update time
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:
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