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 up potential race condition in test cases of "box" (fix #3759) #3760

Merged

Conversation

seaoak
Copy link
Member

@seaoak seaoak commented Oct 12, 2019

What does it do?

Fix up Issue #3759

When "npm test" runs multiple times, a test case in test/scripts/box/box.js fails occasionally.
This is caused by a potential race condition.

The test case "process() - hash changed" fails
if it starts and finishes within wall-clock timer tick (=1ms).

This can be explained by the implementation of "box.Cache" (lib/models/cache.js).
"box.Cache" makes decision about "cache hit/miss" based on "mtime" and "hash" of target file.
"box.Cache" says "cache miss" only when both "mtime" and "hash" are changed.

The test case expects that "box.Cache" says "cache miss" always when "hash" is changed.
Unfortunately "box.Cache" says "cache hit" if "mtime" is not changed.

This patch is to clarify and complement these test cases.

How to test

$ while npm test; do :; done

Pull request tasks

  • Add test cases for the changes.
  • Passed the CI test.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.273% when pulling e353f46 on seaoak:bugfix/test-of-box-fails-on-race-condition into 6f6084c on hexojs:master.

@curbengh curbengh merged commit bd70086 into hexojs:master Oct 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants