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

Remove sleeps and make cron expression more accurate #15172

Merged
merged 4 commits into from
May 29, 2024

Conversation

sambible
Copy link
Contributor

@sambible sambible commented May 23, 2024

Problem Statement

The sleeps in these tests result in inconsistent behavior and the cron expression is malformed, leading to 2 seperate faliures. This PR will fix both.

Solution

Removed the sleep by setting max_tries to 20 on the task poll, reformatted the cron expression to always accurately set the sync time to 5 minutes after the plan is created. 5 minutes is required here due to slow interactions with the UI sometimes resulting in the product not being added until after the sync time had passed.

trigger: test-robottelo
pytest: tests/foreman/ui/test_contenthost.py -k 'test_positive_synchronize_custom_product_custom_cron_real_time'

@sambible sambible 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 May 23, 2024
@sambible sambible requested a review from a team May 23, 2024 23:05
@sambible sambible self-assigned this May 23, 2024
@sambible sambible requested a review from a team as a code owner May 23, 2024 23:05
@sambible
Copy link
Contributor Author

rigger: test-robottelo
pytest: tests/foreman/ui/test_contenthost.py -k 'test_positive_synchronize_custom_product_custom_cron_real_time'

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.

Looks good to me, just added 2 non-blocking proposals. PRT pending.

Comment on lines 199 to 201
next_sync = 5 * 60
# forming cron expression sync repo after 5 min
expected_next_run_time = start_date + timedelta(seconds=next_sync)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we don't use next_sync later, could we go straight?

Suggested change
next_sync = 5 * 60
# forming cron expression sync repo after 5 min
expected_next_run_time = start_date + timedelta(seconds=next_sync)
# forming cron expression sync repo after 5 min
expected_next_run_time = start_date + timedelta(minutes=5)

Comment on lines 265 to 267
next_sync = 5 * 60
# forming cron expression sync repo after 5 min
expected_next_run_time = start_date + timedelta(seconds=next_sync)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.

Copy link
Contributor

@lhellebr lhellebr left a comment

Choose a reason for hiding this comment

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

What did you achieve by changing 3 minutes to 5?
Otherwise, LGTM.

@sambible
Copy link
Contributor Author

Basically the UI test through navigation, and filling out different pages would take more than 3 minutes to add the product to the syncplan, which would mean the trigger for syncing would have already fired, and the product wouldn't get actually synced. 5 minutes seems to be (10 or 20 runs locally) to be consistent in giving enough time for the UI to process all the stuff, and still not be too long.

@sambible
Copy link
Contributor Author

trigger: test-robottelo
pytest: tests/foreman/ui/test_syncplan.py -k 'test_positive_synchronize_custom_product_custom_cron_real_time'

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7151
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/ui/test_syncplan.py -k test_positive_synchronize_custom_product_custom_cron_real_time --external-logging
Test Result : =========== 1 passed, 4 deselected, 20 warnings in 854.64s (0:14:14) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label May 28, 2024
@vsedmik vsedmik merged commit 75de548 into SatelliteQE:master May 29, 2024
10 checks passed
github-actions bot pushed a commit that referenced this pull request May 29, 2024
* Remove sleeps and make cron expression more accurate

* Use minutes instead of seconds variable

(cherry picked from commit 75de548)
github-actions bot pushed a commit that referenced this pull request May 29, 2024
* Remove sleeps and make cron expression more accurate

* Use minutes instead of seconds variable

(cherry picked from commit 75de548)
@dosas
Copy link
Collaborator

dosas commented Jun 19, 2024

What did you achieve by changing 3 minutes to 5? Otherwise, LGTM.

@sambible That's funny when I run the downstream tests the polling is now failing because the ui is too fast :D
Would you be open to a PR changing the search rate to 15: 15 * 20 / 60 = 5 So even for the fastest UI we would be withing the 5 minute mark.

jyejare pushed a commit to jyejare/robottelo that referenced this pull request Oct 19, 2024
* Remove sleeps and make cron expression more accurate

* Use minutes instead of seconds variable
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants