Skip to content

Commit

Permalink
Test: Increase interval delay for definitions integration tests
Browse files Browse the repository at this point in the history
The message was flooding the output and the tests were randomly failing
on the slow CI CPU because the request hogged the CPU.
  • Loading branch information
deribaucourt committed Feb 27, 2024
1 parent f725c24 commit 675ed74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion integration-tests/src/tests/definition.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ suite('Bitbake Definition Test Suite', () => {
position
)
return definitionResult.length > 0
})
}, 5000)
definitionResult.forEach((definition) => {
const receivedUri = getDefinitionUri(definition)
assert.equal(receivedUri.fsPath.endsWith(expectedPathEnding), true)
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/src/utils/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export async function delay (ms: number): Promise<void> {
/// Asserts that the given predicate will come true within the given timeout.
/// Since we often want to test events have happened but they depend on asynchronous
/// external VSCode and extension processes, we can't listen for them directly.
export async function assertWillComeTrue (predicate: () => Promise<boolean>, timeout: number = 300000): Promise<void> {
export async function assertWillComeTrue (predicate: () => Promise<boolean>, interval: number = 250, timeout: number = 300000): Promise<void> {
const startTime = Date.now()
while (!(await predicate()) && (Date.now() - startTime < timeout)) {
await delay(250)
await delay(interval)
}
assert.ok(predicate())
}
Expand Down

0 comments on commit 675ed74

Please sign in to comment.