-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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] Add delay in telemetry test #75162
Changes from 1 commit
78b304b
a853489
a2d7a0e
585838e
6aa6e52
a2cc843
9d163d8
7b34a4e
64fbac8
14df430
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ import { FtrProviderContext } from '../../../ftr_provider_context'; | |
import { API_URLS } from '../../../../../plugins/uptime/common/constants'; | ||
import { makeChecksWithStatus } from './helper/make_checks'; | ||
|
||
const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); | ||
|
||
export default function ({ getService }: FtrProviderContext) { | ||
const supertest = getService('supertest'); | ||
const es = getService('legacyEs'); | ||
|
@@ -84,6 +86,7 @@ export default function ({ getService }: FtrProviderContext) { | |
after('unload heartbeat index', () => getService('esArchiver').unload('uptime/blank')); | ||
|
||
beforeEach(async () => { | ||
await delay(1000); | ||
await es.indices.refresh(); | ||
}); | ||
|
||
|
@@ -119,6 +122,8 @@ export default function ({ getService }: FtrProviderContext) { | |
}); | ||
|
||
it('should receive expected results after calling overview logging', async () => { | ||
// wait few seconds to make sure data is refreshed, just to avoid flakiness | ||
await delay(2000); | ||
// call overview page | ||
const { body: result } = await supertest | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might make sense to try wrapping this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My concern isn't about consistency, it's about the fact that the delay is only necessary if there's something we should be waiting for but we're not waiting for it. What should these tests be waiting for? Can we add a wait for that thing? If we can't, then we can try retrying. Delay's seem to work today, but they age out as performance characteristics change and become very difficult to maintain over time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i agree, will do that |
||
.post(API_URLS.LOG_PAGE_VIEW) | ||
|
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 the delay still needed since we've removed the check for the API response and are now just checking the response code?
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.
removed.