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

Tests need to close Redis connections to pass #116

Merged
merged 2 commits into from
Nov 9, 2019

Conversation

humphd
Copy link
Contributor

@humphd humphd commented Nov 9, 2019

Our one and only test is currently failing:

> jest

 PASS  test/feed-queue.test.js
  ✓ Testing feed-queue.js (3ms)
Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        1.527s
Ran all test suites.
Jest did not exit one second after the test run has completed.

This usually means that there are asynchronous operations that weren't stopped in your tests. Consider running Jest with `--detectOpenHandles` to troubleshoot this issue.

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.

Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received

The build has been terminated

The problem here is that Bull holds open a connection to Redis (which it should), so that it can listen for more jobs to get added to the queue(s). This blocks the tests from finishing. The solution is to ask Bull to close the connection when the tests are done.

I've also fixed the test so that it returns the expected Promise for an async test.

@humphd
Copy link
Contributor Author

humphd commented Nov 9, 2019

I had to update package-lock.json, as it's not in sync with package.json, and blocking TravisCI from installing our deps:

$ npm ci 

npm ERR! cipm can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.

npm ERR! 

npm ERR! 

npm ERR! Missing: dotenv@^8.2.0

npm ERR! Missing: feedparser-promised@^2.0.1

npm ERR! 

@humphd humphd added area: CI/CD Continuous integration / Continuous delivery type: test Creation and development of test labels Nov 9, 2019
@humphd
Copy link
Contributor Author

humphd commented Nov 9, 2019

OK, CI is green now! If a few of you will review this, we can merge and start trusting our CI reports.

Copy link
Contributor

@Immutablevoid Immutablevoid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm package-lock.json is correct since I had the same amount of changes (261 changes) after running npm install for #114, but I didn't add it since I was just changing documentation.

I tested this change on my machine and everything seems to be working fine.

You get this error now when running the test without Redis server on:

(node:46320) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:6379
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1106:14)
(node:46320) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:46320) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can create a new issue to catch this error and display a more user friend error message. This may help jestjs/jest#5311

@humphd
Copy link
Contributor Author

humphd commented Nov 9, 2019

@ImmutableBox I asked @aprilllllllll about this in #48 (comment), where she was talking about the same problem.

I agree, we need an issue filed on this, and a more helpful error message so people understand what's happened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: CI/CD Continuous integration / Continuous delivery type: test Creation and development of test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants