Spoke: Bug: Redis env issues causing flakey tests on main

Created on 2 Dec 2019  ·  4Comments  ·  Source: MoveOnOrg/Spoke

Describe the bug
Tests will fail unpredictably on main with this error:

Jest has detected the following 2 open handles potentially keeping Jest from exiting:
  ●  DNSCHANNEL
      at dns.js:333:23
  ●  TCPWRAP
      28 | 
      29 | if (process.env.REDIS_URL) {
    > 30 |   thinkyConn.r.redis = redis.createClient({ url: process.env.REDIS_URL });
         |                              ^
      31 | } else if (process.env.REDIS_FAKE) {
      32 |   const fakeredis = require("fakeredis");
      33 |   bluebird.promisifyAll(fakeredis.RedisClient.prototype);
      at RedisClient.Object.<anonymous>.RedisClient.create_stream (node_modules/redis/index.js:251:31)
      at new RedisClient (node_modules/redis/index.js:159:10)
      at Object.<anonymous>.exports.createClient (node_modules/redis/index.js:1089:12)
      at Object.createClient (src/server/models/thinky.js:30:30)

When you restart the build they often correct themselves.

To Reproduce
Steps to reproduce the behavior:

  1. Open a PR
  2. If the build fails, click through to the logs
  3. Scroll down to the end
  4. See error

Additional context
I've specifically seen this problem on multiple PRs but haven't seen it yet running yarn test locally. Makes me think that there is a discrepancy there

A-testing C-bug

All 4 comments

@ibrand Can you link to a sample travis build that failed like this?

Here's one:
https://travis-ci.org/MoveOnOrg/Spoke/builds/617843694

Ah, note that the issue is: Timeout - Async callback was not invoked within the 10000ms timeout specified by jest.setTimeout. which I think was run with yarn test-cache

In our current stage-main, test-cache (vs. test-rediscache) is removed
and we also extend the timeout period

Was this page helpful?
0 / 5 - 0 ratings