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: use tmp directory in chdir test #2589

Closed
wants to merge 1 commit into from

Conversation

thefourtheye
Copy link
Contributor

This patch makes chdir test to use the tmp directory and moves the test
to parallel.

CI Run: https://jenkins-iojs.nodesource.com/job/node-test-pull-request/198/

@thefourtheye thefourtheye added the test Issues and PRs related to the tests. label Aug 28, 2015
@brendanashworth
Copy link
Contributor

LGTM if CI is happy

@Fishrock123
Copy link
Contributor

cc @nodejs/build this moves another test to /parallel/

@mscdex mscdex added the process Issues and PRs related to the process subsystem. label Sep 14, 2015
@mscdex
Copy link
Contributor

mscdex commented Sep 14, 2015

I think the filename of this test should be renamed to test-process-chdir.js since it's really testing process.chdir().

This patch

 - makes chdir test to use the tmp directory
 - moves the test to parallel
 - renames the file to test-process-chdir as chdir is in process module
@thefourtheye
Copy link
Contributor Author

@mscdex Good call. Thanks :-) Renamed the file.

@thefourtheye
Copy link
Contributor Author

'weird \uc3a4\uc3ab\uc3af characters \u00e1\u00e2\u00e3');

// Make sure that the tmp directory is clean
common.refreshTmpDir();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is effectively unsafe after using common.tmpDir?

Isn't it possible that your tmpDir is different then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Fishrock123 refresh just removes the directory and creates it

exports.refreshTmpDir = function() {
  rimrafSync(exports.tmpDir);
  fs.mkdirSync(exports.tmpDir);
};

The name is actually decided when we load the module itself,

if (process.env.TEST_THREAD_ID) {
  // Distribute ports in parallel tests
  if (!process.env.NODE_COMMON_PORT)
    exports.PORT += +process.env.TEST_THREAD_ID * 100;

  exports.tmpDirName += '.' + process.env.TEST_THREAD_ID;
}
exports.tmpDir = path.join(exports.testDir, exports.tmpDirName);

Since we are just resolving the path before that, we are safe here.

@thefourtheye
Copy link
Contributor Author

Test is passing in all the environments. @Fishrock123 @mscdex LGTY?

@Trott
Copy link
Member

Trott commented Sep 15, 2015

LGTM if CI is happy

thefourtheye added a commit that referenced this pull request Sep 16, 2015
This patch

 - makes chdir test to use the tmp directory
 - moves the test to parallel
 - renames the file to test-process-chdir as chdir is in process module

PR-URL: #2589
Reviewed-By: Brendan Ashworth <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@thefourtheye
Copy link
Contributor Author

Thanks for the review people. Landed in 9aa6a43

@thefourtheye thefourtheye deleted the improve-test-chdir branch September 16, 2015 23:21
Fishrock123 pushed a commit to Fishrock123/node that referenced this pull request Sep 17, 2015
This patch

 - makes chdir test to use the tmp directory
 - moves the test to parallel
 - renames the file to test-process-chdir as chdir is in process module

PR-URL: nodejs#2589
Reviewed-By: Brendan Ashworth <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
@rvagg rvagg mentioned this pull request Sep 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
process Issues and PRs related to the process subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants