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

Flaky tests #1357

Closed
na-- opened this issue Mar 11, 2020 · 10 comments
Closed

Flaky tests #1357

na-- opened this issue Mar 11, 2020 · 10 comments
Assignees
Milestone

Comments

@na--
Copy link
Member

na-- commented Mar 11, 2020

Just a list of tests we have noticed are flaky in CI runs, so we don't forget to fix/refactor them before merging #1007 in master:

TestVariableLoopingVUsRun - https://ci.appveyor.com/project/robingustafsson/k6/builds/31408611

@na--
Copy link
Member Author

na-- commented Mar 17, 2020

TestVariableLoopingVUsRampDownNoWobble - https://circleci.com/gh/loadimpact/k6/9110

@imiric imiric self-assigned this Mar 20, 2020
@imiric
Copy link
Contributor

imiric commented Mar 25, 2020

I refactored these two tests and they seem more stable, but while stress testing lib/executor, I've also seen these fail occasionally (mostly on Windows; ordered by approx. failure rate, highest first):

  • TestExternallyControlledRun
  • TestConstantArrivalRateRunCorrectRate
  • TestVariableArrivalRateRunCorrectRate
  • TestConstantLoopingVUsRun
  • TestPerVUIterationsRunVariableVU
  • TestSharedIterationsRunVariableVU

@mstoykov
Copy link
Collaborator

they will probably get changed with the striping algorithm and rewrite so maybe just wait until then ?

@imiric
Copy link
Contributor

imiric commented Mar 30, 2020

Another one 😞: core.TestMetricsEmission: https://circleci.com/gh/loadimpact/k6/9243

@na--
Copy link
Member Author

na-- commented Apr 14, 2020

Another TestConstantArrivalRateRunCorrectRate failure: https://circleci.com/gh/loadimpact/k6/9464

@na--
Copy link
Member Author

na-- commented Apr 16, 2020

TestExternallyControlledRun flakiness: https://circleci.com/gh/loadimpact/k6/9530

@na--
Copy link
Member Author

na-- commented May 25, 2020

@imiric
Copy link
Contributor

imiric commented Jul 7, 2020

I'm exploring that article and the time mocking packages, but one thing concerns me, mentioned in golang/go#8869:

The benbjohnson clock package attempts to make Ticker and Timer calls (as well as their
related AfterFunc and Sleep methods) work against a fake time that can be set and
updated in tests. However, it relies on some micro-sleeps and runtime.Gosched calls that
are obviously going to be flaky.

It would be a substantial effort to convert the entire codebase to use this Clock interface. Is that really worth it if it doesn't guarantee deterministic tests?

Also see grafana/metrictank#342, where they abandon it altogether.

The article author uses a fork where this might not be an issue(?), but not sure if this can be fixed outside of the stdlib.
So I think the way forward will be much harder: rewriting tests to ensure they rely on timing as little as possible or not at all, which might be impossible in some cases. I'll take a look at some of the current ones and see what can be done.

@imiric
Copy link
Contributor

imiric commented Jul 9, 2020

A recently added one: TestConstantArrivalRateDroppedIterations, seems to fail frequently:

https://ci.appveyor.com/project/robingustafsson/k6/builds/33999101
https://ci.appveyor.com/project/robingustafsson/k6/builds/33998965

@na-- na-- added this to the v0.27.1 milestone Jul 9, 2020
mstoykov added a commit that referenced this issue Jul 20, 2020
@na--
Copy link
Member Author

na-- commented Jul 22, 2020

I'm closing this, since most, if not all, of these tests should have been fixed by now. We can make new issues for every new flaky test we find.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants