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 flakey tests #1322

Closed
megawac opened this issue Nov 13, 2016 · 16 comments
Closed

Fix flakey tests #1322

megawac opened this issue Nov 13, 2016 · 16 comments

Comments

@megawac
Copy link
Collaborator

megawac commented Nov 13, 2016

Several of the tests (especially in the queue test suite) fail quite frequently. This is due to setTimeout timing issues. We could sort of address this by increasing the delays but that isn't a proper solution. These tests probably just need rewrites.

These issues have been observed several times in the past

I created PR #1321 as a stopgap, to alleviate some of the issues a bit by retrying the flakier tests when they fail. All retries we implement should be removed along with this fix for this issue as retries in unit tests are really ugly and may be masking other issues with the library.

Note: this may be difficult to reproduce on your local system. I've mainly noticed it in simulated environments with slower systems causing setTimeout calls to be delayed. Systems like travis/sauce fail quite frequently

@aearly
Copy link
Collaborator

aearly commented Nov 29, 2016

The mapValues tests were written in such a way that they verify concurrency without using timeouts. Someone could use a similar strategy for refactoring tests that use timeouts.

@aearly
Copy link
Collaborator

aearly commented Apr 10, 2017

Got some interesting new failures here: https://travis-ci.org/caolan/async/builds/220394697

Don't know what happened in the first applyEach test. Also fascinating to see that setTimeout(50) + setTimeout(50) = 99 in the retry test.

1) applyEach applyEach:
      Uncaught AssertionError: expected [ 'one', 'two', 'three' ] to deeply equal [ 'two', 'one', 'three' ]
      + expected - actual
       [
      +  "two"
         "one"
      -  "two"
         "three"
       ]
      at mocha_test/applyEach.js:32:35
  1) retry retry with interval when all attempts fail:
     Uncaught AssertionError: expected 99 to be above 99
      at mocha_test/retry.js:72:36

aearly added a commit that referenced this issue Apr 16, 2017
@aearly
Copy link
Collaborator

aearly commented Apr 26, 2017

  asyncify
    promisified
      bluebird
        ✔ resolve
WARN: '%cWarning: a promise was rejected with a non-error: [object String]
    (No stack trace)

@aearly
Copy link
Collaborator

aearly commented Apr 30, 2017

  parallel
    ✖ parallel object
      Firefox 52.0.0 (Linux 0.0.0)
    Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

@aearly
Copy link
Collaborator

aearly commented May 22, 2017

FAILED TESTS:
  cargo
    ✖ without callback
      Firefox 52.0.0 (Linux 0.0.0)
    AssertionError: expected [ Array(3) ] to deeply equal [ Array(4) ] (:0)

@hargasinski
Copy link
Collaborator

FAILED TESTS:
  cargo
    ✖ bulk task
      Firefox 52.0.0 (Linux 0.0.0)
    AssertionError: expected [ Array(4) ] to deeply equal [ Array(6) ] (:0)

@hargasinski
Copy link
Collaborator

FAILED TESTS:
  cargo
    ✖ drain twice
      Firefox 52.0.0 (Linux 0.0.0)
    AssertionError: expected 1 to equal 2 (:0)

@hargasinski
Copy link
Collaborator

The concat error might be on me?

FAILED TESTS:
  concat
    concat
      ✖ basics
        Firefox 52.0.0 (Linux 0.0.0)
      Timeout of 250ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.
      require<["/home/travis/build/caolan/async/mocha_test/concat.js"]</</</</<@/tmp/mocha_test/concat.js:22:16 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:7703:17
      require<[10]</exports.default/<@/tmp/lib/concatLimit.js:41:15 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:873:16
      _asyncMap/<@/tmp/lib/internal/map.js:18:8 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:3503:9
      once/<@/tmp/lib/internal/once.js:6:8 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:3530:9
      iterateeCallback@/tmp/lib/internal/eachOfLimit.js:27:23 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:3266:24
      onlyOnce/<@/tmp/lib/internal/onlyOnce.js:6:8 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:3546:9
      _asyncMap/</<@/tmp/lib/internal/map.js:15:12 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:3500:13
      require<[10]</exports.default/</<@/tmp/lib/concatLimit.js:30:19 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:862:20
      concatIteratee/<@/tmp/mocha_test/concat.js:11:12 <- /tmp/96399286a833e1592b04287ff5e22018.browserify:7692:13
      
  queue
    ✖ bulk task
      Firefox 52.0.0 (Linux 0.0.0)
    AssertionError: expected [ Array(8) ] to deeply equal [ Array(8) ] (:0)

@aearly
Copy link
Collaborator

aearly commented Jun 26, 2017

  concat
    concatLimit
      ✖ does not continue replenishing after error
        Firefox 52.0.0 (Linux 0.0.0)
      Timeout of 250ms exceeded. 

@aearly
Copy link
Collaborator

aearly commented Jun 26, 2017

I'm this close 👌 to just disabling the firefox tests. They're the only tests that are flakey these days, probably due to limited CPU resources in Travis causing timeouts to not fire predictably.

@aearly
Copy link
Collaborator

aearly commented Jun 26, 2017

  cargo
    ✖ without callback
      Firefox 52.0.0 (Linux 0.0.0)
    AssertionError: expected [ Array(3) ] to deeply equal [ Array(4) ] (:0)

@aearly
Copy link
Collaborator

aearly commented Jun 26, 2017

  concat
    concat
      ✖ preserves order
        Firefox 52.0.0 (Linux 0.0.0)
      Timeout of 250ms exceeded.

@hargasinski
Copy link
Collaborator

FAILED TESTS:
  cargo
    ✖ without callback
      Firefox 52.0.0 (Linux 0.0.0)
    AssertionError: expected [ Array(3) ] to deeply equal [ Array(4) ] (:0)

@hargasinski
Copy link
Collaborator

  concat
    concat
      ✖ preserves order
        Firefox 52.0.0 (Linux 0.0.0)
      Timeout of 250ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves.

@hargasinski
Copy link
Collaborator

FAILED TESTS:
  queue
    ✖ basics
      Firefox 52.0.0 (Linux 0.0.0)
    AssertionError: expected [ Array(8) ] to deeply equal [ Array(8) ] (:0)
    ✖ bulk task
      Firefox 52.0.0 (Linux 0.0.0)
    AssertionError: expected [ Array(8) ] to deeply equal [ Array(8) ] (:0)

@aearly
Copy link
Collaborator

aearly commented May 20, 2019

Tests have been pretty solid after that browser CI PR. We can re-open if we find other flaky tests.

@aearly aearly closed this as completed May 20, 2019
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