Topcoder Project Service - Fix random tests failures

Register
Submit a solution
The challenge is finished.

Challenge Overview

Fix unit tests so they don’t fail randomly. 

Project Background

Topcoder Project Service is the main backend service of Topcode Connect – client-facing application of Topcoder. We have many unit tests that generally run successfully, but often some unit tests fail randomly. If we run files with tests one by one then they run successfully, so generally, they are correct.

Technology Stack

  • Node.js

  • PostgreSQL

  • ElasticSearch

Code access

The work for this challenge has to be done in one repository:
- Project Service repo https://github.com/topcoder-platform/tc-project-service branch develop commit 6d80dd51b6485152987c772ad916ce9c9ac1c952 or later.

- Config for local setup is provided on the forum.
- Follow "Local Development" guide to run the app locally.

Individual requirements

On the forum, we provide 3 example logs of failed tests:
- 2 examples of unit tests failed on CircleCI when running command "npm run test"
- 1 example of unit tests failing when running locally only a small part of tests by command "NODE_ENV=test npm run lint && NODE_ENV=test npm run sync:es && NODE_ENV=test npm run sync:db && NODE_ENV=test ./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- --timeout 10000 --require babel-core/register $(find src -path '*projects/*spec.js*') --exit"

Most likely the root cause of failures is similar when we run all tests or part of the tests, so you may use the second command to run a part of the tests to begin with, as it's much faster to run than to run all the tests together.

  • When we run all tests together by “npm run test” they should not fail randomly. 

  • Also, unit tests should not fail randomly if we run unit tests only for projects directory (second command).

  • The root cause of random fails should be found and fixed. We shouldn’t just increase the timeouts as timeouts we have are already suppose to be more than enough.

General requirements

  • Existent unit tests should pass.

  • Lint should pass.

  • Git patch should be without errors or warnings.

Judging Criteria

  • "npm run test" shouldn't fail at least 5 times in a row when running locally or on CircleCI

  • the second command for "projects" folder shouldn't fail at least 10 times in a row when running locally

  • the root cause is fixed

If you have any questions or concerns, please, feel free to ask on the forum.



Final Submission Guidelines

Submit a zip file which would include:

  • Git patch with changes you’ve made to the code in our repository.

Additionally, the winner would be required to raise a pull request to the repository after the challenge is completed.

Review style

Final Review

Community Review Board

Approval

User Sign-Off

Challenge links

ID: 30120749