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

Use require.Eventually instead of time.Sleep in unit test #2480

Merged

Conversation

ycombinator
Copy link
Contributor

@ycombinator ycombinator commented Apr 11, 2023

What does this PR do?

This PR uses require.Eventually instead of time.Sleep in a unit test.

Why is it important?

It makes the test's timing less dependent on the speed of the system the test is being executed on, thus making the test less likely to be flaky.

Follow up to #2473.

@ycombinator ycombinator added Cleanup backport-v8.7.0 Automated backport with mergify labels Apr 11, 2023
@ycombinator ycombinator requested a review from a team as a code owner April 11, 2023 09:36
@ycombinator ycombinator requested review from michel-laterman and pchila and removed request for a team April 11, 2023 09:36
@ycombinator ycombinator changed the title Use require.Eventually instead of time.Sleep Use require.Eventually instead of time.Sleep in unit test Apr 11, 2023
@ycombinator ycombinator requested a review from rdner April 11, 2023 09:36
@elasticmachine
Copy link
Contributor

elasticmachine commented Apr 11, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-04-11T15:34:58.261+0000

  • Duration: 17 min 24 sec

Test stats 🧪

Test Results
Failed 0
Passed 5451
Skipped 23
Total 5474

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@elasticmachine
Copy link
Contributor

elasticmachine commented Apr 11, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.507% (66/67) 👍
Files 69.432% (159/229) 👍
Classes 68.65% (300/437) 👍
Methods 54.054% (920/1702) 👎 -0.032
Lines 39.326% (10358/26339) 👍 0.033
Conditionals 100.0% (0/0) 💚

@mergify
Copy link
Contributor

mergify bot commented Apr 11, 2023

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b test-fqdn-toggle-use-eventually upstream/test-fqdn-toggle-use-eventually
git merge upstream/main
git push upstream test-fqdn-toggle-use-eventually

Copy link
Contributor

@blakerouse blakerouse 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.

@ycombinator ycombinator force-pushed the test-fqdn-toggle-use-eventually branch from ed591c3 to aed8d30 Compare April 11, 2023 15:34
@ycombinator ycombinator merged commit 70843ed into elastic:main Apr 11, 2023
@ycombinator ycombinator deleted the test-fqdn-toggle-use-eventually branch April 11, 2023 15:58
mergify bot pushed a commit that referenced this pull request Apr 11, 2023
(cherry picked from commit 70843ed)

# Conflicts:
#	internal/pkg/composable/providers/host/host_test.go
ycombinator added a commit that referenced this pull request Apr 11, 2023
…` in unit test (#2484)

* Use require.Eventually instead of time.Sleep (#2480)

(cherry picked from commit 70843ed)

# Conflicts:
#	internal/pkg/composable/providers/host/host_test.go

* Fix conflicts

---------

Co-authored-by: Shaunak Kashyap <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.7.0 Automated backport with mergify Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants