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

[Uptime] [Test] Repurpose unit test assertions to avoid flakiness #40650

Merged

Conversation

justinkambic
Copy link
Contributor

Summary

I had previously revised these tests to utilize Jest's toBeCloseTo assertion, because it provides a precision parameter. My understanding when I implemented this test was that it would check n significant digits, so if I ran code like expect(myValue).toBeCloseTo(36000, 3), a value like 36015 would be accepted by the assertion. After seeing this test fail in a flaky way while testing other changes (it failed when myValue === 36001), I researched the function more closely and found that it does not behave this way.

This led me to opt for the current solution, which should help avoid any flakiness issues while continuing to rely on the end-user simplicity of a snapshot. I do not expect a variance greater than 1 when running these tests, so the threshold of 100 should be sufficient to consider these tests stable.

Testing this PR

Run the unit test suites. Should be all green.

I'm ok with running these changes many times if we want to ensure there's no flakiness introduced.

@justinkambic justinkambic added test v8.0.0 Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability release_note:skip Skip the PR/issue when compiling release notes v7.3.0 v7.4.0 labels Jul 9, 2019
@justinkambic justinkambic requested a review from spalger July 9, 2019 15:44
@justinkambic justinkambic self-assigned this Jul 9, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/uptime

@justinkambic justinkambic changed the title [Uptime] Repurpose unit test assertions to avoid flakiness [Uptime] [Test] Repurpose unit test assertions to avoid flakiness Jul 9, 2019
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@justinkambic justinkambic force-pushed the uptime_es-monitors-flaky-unit-test branch from 666b7be to 7126990 Compare July 12, 2019 12:17
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@justinkambic
Copy link
Contributor Author

Thanks for the feedback, I'll ping y'all when I come back around to this.

@justinkambic justinkambic requested review from spalger and andrewvc July 23, 2019 23:36
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@andrewvc
Copy link
Contributor

jenkins, retest this please (to ensure that this is still not flakey)

Copy link
Contributor

@andrewvc andrewvc left a comment

Choose a reason for hiding this comment

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

LGTM WFGGG

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@andrewvc
Copy link
Contributor

@spalger looks like @justinkambic made all the changes you requested, we still need your approval to merge this one.

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

LGTM

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@andrewvc andrewvc merged commit 6b3430e into elastic:master Aug 8, 2019
andrewvc pushed a commit to andrewvc/kibana that referenced this pull request Aug 8, 2019
…astic#40650)

I had previously revised these tests to utilize Jest's toBeCloseTo assertion, because it provides a precision parameter. My understanding when I implemented this test was that it would check n significant digits, so if I ran code like expect(myValue).toBeCloseTo(36000, 3), a value like 36015 would be accepted by the assertion. After seeing this test fail in a flaky way while testing other changes (it failed when myValue === 36001), I researched the function more closely and found that it does not behave this way.

This led me to opt for the current solution, which should help avoid any flakiness issues while continuing to rely on the end-user simplicity of a snapshot. I do not expect a variance greater than 1 when running these tests, so the threshold of 100 should be sufficient to consider these tests stable.
jloleysens added a commit to jloleysens/kibana that referenced this pull request Aug 9, 2019
…p-metrics-selectall

* 'master' of github.com:elastic/kibana: (306 commits)
  [ML] Adding job overrides to the module setup endpoint (elastic#42946)
  [APM] Fix missing RUM url (elastic#42940)
  close socket timeouts without message (elastic#42456)
  Upgrade elastic/charts to 8.1.6 (elastic#42518)
  [ML] Delete old AngularJS data visualizer and refactor folders (elastic#42962)
  Add custom formatting for Date Nanos Format (elastic#42445)
  [Vega] Shim new platform - vega_fn.js -> vega_fn.js , use ExpressionFunction (elastic#42582)
  add socket.getPeerCertificate to KibanaRequest (elastic#42929)
  [Automation] ISTANBUL PRESET PATH is not working fine with constructor(private foo) (elastic#42683)
  [ML] Data frames: Updated stats structure. (elastic#42923)
  [Code] fixed the issue that the repository can not be deleted in some cases. (elastic#42841)
  [kbn-es] Support for passing regex value to ES (elastic#42651)
  Connect to Elasticsearch via SSL when starting kibana with `--ssl` (elastic#42840)
  Add Elasticsearch SSL support for integration tests (elastic#41765)
  Fix duplicate fetch in Visualize (elastic#41204)
  [DOCS] TSVB and Timelion clean up (elastic#42953)
  [Maps] [File upload] Fix maps geojson upload hanging on index step (elastic#42623)
  [APM] Use rounded bucket sizes for transaction distribution (elastic#42830)
  [yarn.lock] consistent resolve domain (elastic#42969)
  [Uptime] [Test] Repurpose unit test assertions to avoid flakiness (elastic#40650)
  ...
andrewvc added a commit that referenced this pull request Sep 4, 2019
…0650) (#42977)

I had previously revised these tests to utilize Jest's toBeCloseTo assertion, because it provides a precision parameter. My understanding when I implemented this test was that it would check n significant digits, so if I ran code like expect(myValue).toBeCloseTo(36000, 3), a value like 36015 would be accepted by the assertion. After seeing this test fail in a flaky way while testing other changes (it failed when myValue === 36001), I researched the function more closely and found that it does not behave this way.

This led me to opt for the current solution, which should help avoid any flakiness issues while continuing to rely on the end-user simplicity of a snapshot. I do not expect a variance greater than 1 when running these tests, so the threshold of 100 should be sufficient to consider these tests stable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release_note:skip Skip the PR/issue when compiling release notes Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability test v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants