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

Make the tests less flaky #150

Merged
merged 10 commits into from
Dec 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions test/mainLoop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ var port = 25212
var lastReq
var smallestInterval
const server = http.createServer(function (req, res) {
if (counter % 4 === 0) {
counter++
res.writeHead(404)
res.end()
return
}
if (req.url === "/http-queue/get-a-job") {
if (!lastReq) {
lastReq = Date.now()
Expand Down Expand Up @@ -114,8 +120,9 @@ describe('Main cloud loop', () => {
}
stopIt()
server.close()
if (smallestInterval < sleepTime) {
throw new Error('Smallest interval (' + smallestInterval + ') was smaller than the smallest pause (' + sleepTime + ')')
// Allow a small offset. Seems tests are failing with 99ms flakily.
if (smallestInterval < (sleepTime - 20)) {
throw new Error('Smallest interval (' + smallestInterval + ') was smaller than the smallest pause (' + sleepTime + ') well minus the offset')
}
resolve(null)
})
Expand Down
Loading