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

Fix nondeterministic test failures #173

Closed
pokey opened this issue Aug 1, 2021 · 15 comments · Fixed by #239
Closed

Fix nondeterministic test failures #173

pokey opened this issue Aug 1, 2021 · 15 comments · Fixed by #239
Labels
code quality Improvements to code quality
Milestone

Comments

@pokey
Copy link
Member

pokey commented Aug 1, 2021

Let's start by just retrying tests 3 times if they fail. This approach is terrible, because it swallows all nondeterministic bugs, but at least we can start requiring CI passes, unlike now where they're disabled because they fail

Originally posted by @pokey in #172 (comment)

@pokey
Copy link
Member Author

pokey commented Aug 2, 2021

@AndreasArvidsson @brxck lets move the sleep discussion here. Here's @AndreasArvidsson's comment from the PR:

@brxck Is it only mac that needs the sleep time? If that's the case we could probably do something like this. Not as optimal as removing the sleep totally foriall platforms but still better than having them where they are not needed.


if (os.platform() === "darwin") {

        await new Promise((resolve) => setTimeout(resolve, 100));

 }

@pokey
Copy link
Member Author

pokey commented Aug 2, 2021

@AndreasArvidsson It's actually only macOS in CI, so we might be able to be even more specific by checking env var to see if CI as well as your os check

It's quite odd it needs a sleep at all tbh because there's nothing async going on there. It's just setting some stuff in an object.

@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented Aug 2, 2021

Then that sounds like a good solution :)

I've already pushed the operating system change. Which env var would be the easiest way to detect CI?

@pokey
Copy link
Member Author

pokey commented Aug 2, 2021

@brxck
Copy link
Collaborator

brxck commented Aug 2, 2021

I'll say that tests on Ubuntu occasionally had the same problem, including my own (not slow) machine.

It is a weird problem... I had an alternative idea of adding retry logic to where we check the navigationMap?

@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented Aug 2, 2021

@pokey I should probably work

if (process.platform === "darwin" && process.env["CI"]) {
        await new Promise((resolve) => setTimeout(resolve, 100));
}

@brxck Okay then above might not be a good solution after all.

@pokey
Copy link
Member Author

pokey commented Aug 2, 2021

Yeah given @brxck 's comment I think exponential backoff is the way to go

@AndreasArvidsson
Copy link
Member

AndreasArvidsson commented Aug 2, 2021

A retry logic sounds like a good idea.

@AndreasArvidsson
Copy link
Member

A retry logic is now implemented. Doing three tries with 100 mill seconds between each.

@pokey
Copy link
Member Author

pokey commented Aug 2, 2021

Looks like that still failed; I switched it to exponential so hopefully that's more reliable

#174

@pokey
Copy link
Member Author

pokey commented Aug 2, 2021

Weird that didn't seem to help. Maybe it's not a timing thing? Maybe it's actually just nondeterministic for some reason? We should figure out how get more useful output from the assertion

@AndreasArvidsson
Copy link
Member

Yes if a three second sleep doesn't help it's not that.

@pokey
Copy link
Member Author

pokey commented Aug 2, 2021

Yeah the first question to figure out is whether it is not doing the decorations or if it is doing them but they don't match our expectations

@pokey
Copy link
Member Author

pokey commented Aug 2, 2021

I kind of have the feeling that the sleep makes no difference 😂

@AndreasArvidsson
Copy link
Member

Well that's just great then :D

@pokey pokey added this to the 1.0.0 milestone Aug 6, 2021
@pokey pokey added the code quality Improvements to code quality label Aug 6, 2021
@pokey pokey changed the title Remove 100ms sleep in tests Fix nondeterministic test failures Aug 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Improvements to code quality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants