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: extend test timeout for windows #4657

Merged
merged 2 commits into from
Feb 17, 2020

Conversation

dougal83
Copy link
Contributor

@dougal83 dougal83 commented Feb 15, 2020

Give windows extra time to complete tests
Fixes #4425

fix: cleanup tilde-path-app post test …
ensure test app is remove afterward
Fixes #4652

Checklist

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide

@dougal83
Copy link
Contributor Author

@derdeka If you have time, could you please run tests against this PR?

@dougal83 dougal83 added the os:Windows Issues specific to Windows label Feb 15, 2020
Comment on lines 298 to 307
// If the test runs outside $home directory
if (process.env.CI && !process.env.DEBUG) {
process.chdir(sandbox);
} else {
process.chdir(rootDir);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@agnes512 Does this look reasonable? I had to do this for CI test but I'm not sure how that works. I've also dropped a clause to compare the sandbox path from L266.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I find this suspicious. On the next line, we are running a cleanup script in the sandbox directory:

https://github.com/strongloop/loopback-next/blob/9aba52e59c80830dd0871c4a087b90ec2aa21db2/packages/cli/test/integration/generators/app.integration.js#L304

Does the behavior of run-clean depend on the current working directory? If it does not, then perhaps we can get rid of this first process.chdir entirely, and keep the last chdir(cwd) only?

   after(function() {
    // Increase the timeout to accommodate slow CI build machines
    // eslint-disable-next-line no-invalid-this
    this.timeout(30 * 1000);

    build.clean(['node', 'run-clean', sandbox]);
    process.chdir(cwd);
  });

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This appears to be a special case for tilde check. We are using sandbox that is outside the code's project root. Not setting the process.chdir gives for example: Skipping /home/dev/workspace/loopback-next/sandbox/tilde-path-app as it is not inside the project root directory.

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

@dougal83 thank you for continuing the investigation of test failures on Windows! ❤️

The commit changing test timeouts LTGM, let's discuss how to best fix the tilde test.

Comment on lines 298 to 307
// If the test runs outside $home directory
if (process.env.CI && !process.env.DEBUG) {
process.chdir(sandbox);
} else {
process.chdir(rootDir);
}
Copy link
Member

Choose a reason for hiding this comment

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

Hmm, I find this suspicious. On the next line, we are running a cleanup script in the sandbox directory:

https://github.com/strongloop/loopback-next/blob/9aba52e59c80830dd0871c4a087b90ec2aa21db2/packages/cli/test/integration/generators/app.integration.js#L304

Does the behavior of run-clean depend on the current working directory? If it does not, then perhaps we can get rid of this first process.chdir entirely, and keep the last chdir(cwd) only?

   after(function() {
    // Increase the timeout to accommodate slow CI build machines
    // eslint-disable-next-line no-invalid-this
    this.timeout(30 * 1000);

    build.clean(['node', 'run-clean', sandbox]);
    process.chdir(cwd);
  });

Copy link
Contributor

@derdeka derdeka left a comment

Choose a reason for hiding this comment

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

The changed timeouts LGTM and fixed failed tests for me.

Before this change:
3088 passing (5m)
13 pending
4 failing

With your change:
3092 passing (5m)
13 pending

The changes to directory changing looks strange to me and seems unrelated. Maybe you can split this into a seperate PR as this needs more discussion or should be refactored at all.

give windows extra time to complete tests

Fix loopbackio#4425

Signed-off-by: Douglas McConnachie <[email protected]>
ensure test app is remove afterward

follows: loopbackio#4652
Signed-off-by: Douglas McConnachie <[email protected]>
@dougal83
Copy link
Contributor Author

npm ERR! 429 Too Many Requests - GET https://registry.npmjs.org/@commitlint/cli/-/cli-8.3.5.tgz

Usually Cloudflare? Will manually restart test later.

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

LGTM 👍

The chdir fix is not pretty, but as long as it works, I think it's best to land it now and then clean it up later (if at all).

@agnes512 AFAICT from git blame, the tilde test was introduced by you as part of #3252. Can you please review the proposed changes and check if they preserve the intent of your test?

@dougal83
Copy link
Contributor Author

The chdir fix is not pretty, but as long as it works, I think it's best to land it now and then clean it up later (if at all).

Amen. 🙏

Copy link
Contributor

@agnes512 agnes512 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for fixing it!

@raymondfeng raymondfeng merged commit 4562a50 into loopbackio:master Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
os:Windows Issues specific to Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

npm test hangs infinitly on windows
5 participants