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

test(load-database): fix EPERM error in windows #4069

Merged
merged 1 commit into from
Jan 13, 2020

Conversation

curbengh
Copy link
Contributor

@curbengh curbengh commented Jan 10, 2020

What does it do?

Continuation of #3975

Add workarounds for more reliable unit testing on Windows in CI env.

How to test

git clone -b BRANCH https://github.com/USER/hexo.git
cd hexo
npm install
npm test

Screenshots

Pull request tasks

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

Sorry, something went wrong.

@coveralls
Copy link

coveralls commented Jan 10, 2020

Coverage Status

Coverage remained the same at 97.706% when pulling 1cd60a1 on curbengh:db-load-windows-2 into 5c098cc on hexojs:master.

@curbengh curbengh force-pushed the db-load-windows-2 branch 5 times, most recently from e7dccf4 to 2e97a09 Compare January 10, 2020 08:40
@SukkaW
Copy link
Member

SukkaW commented Jan 10, 2020

Strangely.

Travis build is fine in my newest PR #4070. It looks like the E*** issue only occurs occasionally.

@curbengh curbengh force-pushed the db-load-windows-2 branch 2 times, most recently from e9ec221 to 07194c6 Compare January 10, 2020 09:47
@curbengh
Copy link
Contributor Author

It looks like the E*** issue only occurs occasionally.

the behavior is erratic. Console - generate - watch - delete is also inconsistent.

@curbengh curbengh force-pushed the db-load-windows-2 branch 6 times, most recently from a843fa1 to 1cd60a1 Compare January 10, 2020 11:16
@curbengh
Copy link
Contributor Author

curbengh commented Jan 10, 2020

Still have soft error in Node 8 Windows:

Unhandled rejection Error: ENOENT: no such file or directory, stat 'C:\Users\travis\build\hexojs\hexo\test\scripts\processors\source\foo.jpg'

#4037 may help (or not, see hexojs/hexo-fs#49 hexojs/hexo-fs#50).

@SukkaW
Copy link
Member

SukkaW commented Jan 10, 2020

@curbengh What about patch watch() - rename folder as well? My local machine (WSL 1) always failed on this item.

image

@curbengh
Copy link
Contributor Author

curbengh commented Jan 10, 2020

Have you tried reverting #3965?

Check the folder box_tmp/test/a and b.txt's ownership and permission after this line,

writeFile(src, 'a'),

@SukkaW
Copy link
Member

SukkaW commented Jan 10, 2020

@curbengh That error is not related with #3965. I believe WSL and its file watch strategy should be blamed.

@curbengh
Copy link
Contributor Author

curbengh commented Jan 11, 2020

Another workaround I can think of is adding a delay (as used in this PR), await Promise.delay(300), perhaps before or after or both,

await box.watch();


Node's FS api can be tricky in Windows microsoft/azure-pipelines-tasks#5472

@curbengh curbengh marked this pull request as ready for review January 12, 2020 10:33
@curbengh
Copy link
Contributor Author

@SukkaW

If the workaround doesn't work, then this PR is ready (I can't think of any other workaround).

Copy link
Member

@SukkaW SukkaW left a comment

Choose a reason for hiding this comment

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

LGTM!

@curbengh curbengh merged commit 05a8a47 into hexojs:master Jan 13, 2020
@curbengh curbengh deleted the db-load-windows-2 branch January 13, 2020 22:41
@curbengh curbengh mentioned this pull request Jan 13, 2020
2 tasks
@SukkaW SukkaW mentioned this pull request Jul 25, 2020
22 tasks
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

3 participants