Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Parallel suites #42

Merged
merged 9 commits into from Oct 11, 2012

Conversation

Projects
None yet
3 participants
Contributor

sam-falvo commented Oct 10, 2012

No description provided.

@pquerna pquerna and 2 others commented on an outdated diff Oct 10, 2012

@@ -26,6 +26,7 @@ var execSync = require('child_process').execSync;
var sprintf = require('sprintf').sprintf;
var async = require('async');
var logmagic = require('logmagic');
+var _ = require('underscore');
@pquerna

pquerna Oct 10, 2012

Owner

Adding a dependency on underscore just to find if a intersection exists seems a little excessive, @Kami thougths?

Also I think we should call it var underscore, rather than using _

@sam-falvo

sam-falvo Oct 10, 2012

Contributor

It was recommended to me by Matt. I was originally going to write it using explicit looping, but the code wouldn't be very succinct at all.

@Kami

Kami Oct 10, 2012

Member

I don't mind adding underscore as a dependency as long reference it with underscore instead of _.

@sam-falvo

sam-falvo Oct 11, 2012

Contributor

Fixed.

@Kami Kami and 1 other commented on an outdated diff Oct 10, 2012

@@ -1,5 +1,18 @@
#!/usr/bin/env bash
-CWD=`pwd`
+CWD=`dirname $0`
+CWD=`cd "$APP_DIR";pwd`
+
+"${CWD}/bin/whiskey" --independent-tests "${CWD}/example/test-long-running-1.js ${CWD}/example/test-long-running-2.js"
@Kami

Kami Oct 10, 2012

Member

This test should also assert how long it took to run the tests. In this case (using `--indenpendent-tests) it should be less then 6 seconds or so.

@sam-falvo

sam-falvo Oct 11, 2012

Contributor

Fixed.

@Kami Kami and 1 other commented on an outdated diff Oct 10, 2012

example/test-long-running-1.js
@@ -0,0 +1,7 @@
+exports.test_long_running_1 = function(test, assert) {
+ setTimeout(function() {
+ assert.equal(1,1);
+ test.finish();
+ }, 5000);
+}
+
@Kami

Kami Oct 10, 2012

Member

trailing blank line

@sam-falvo

sam-falvo Oct 10, 2012

Contributor

Really?!

@sam-falvo

sam-falvo Oct 11, 2012

Contributor

Fixed

@Kami Kami and 1 other commented on an outdated diff Oct 10, 2012

});
}
+ function onBound() {
+ self._testReporter.handleTestsStart();
+ async.series([
+ async.forEachLimit.bind(null, self._independent_tests, 5, runSuite),
@Kami

Kami Oct 10, 2012

Member

Concurrency (5) should probably be a command-line option.

@sam-falvo

sam-falvo Oct 10, 2012

Contributor

It will be, per my IRC message from yesterday. I'll be in hire training all day today, but I should have that feature added by tomorrow.

@sam-falvo

sam-falvo Oct 11, 2012

Contributor

Fixed.

@Kami Kami commented on an outdated diff Oct 11, 2012

@@ -439,12 +443,30 @@ function run(cwd, argv) {
var coverageObj = coverage.aggregateCoverage(options['coverage-files'].split(','));
this._coverageReporter.handleTestsComplete(coverageObj);
}
- else if (options.tests && options.tests.length > 0) {
- options.tests = options.tests.split(' ');
+ else if ((options.tests && options.tests.length > 0) ||
+ (options['independent-tests'] && options['independent-tests'].length > 0)) {
+ options.tests = options.tests ? options.tests.split(' ') : [];
+ options['independent-tests'] = options['independent-tests'] ? options['independent-tests'].split(' ') : [];
+
+ var ms = parseInt(options['max-suites']);
@Kami

Kami Oct 11, 2012

Member

Need to specify a radix - parseInt(number, 10);

@Kami Kami commented on an outdated diff Oct 11, 2012

@@ -439,12 +443,30 @@ function run(cwd, argv) {
var coverageObj = coverage.aggregateCoverage(options['coverage-files'].split(','));
this._coverageReporter.handleTestsComplete(coverageObj);
}
- else if (options.tests && options.tests.length > 0) {
- options.tests = options.tests.split(' ');
+ else if ((options.tests && options.tests.length > 0) ||
+ (options['independent-tests'] && options['independent-tests'].length > 0)) {
+ options.tests = options.tests ? options.tests.split(' ') : [];
+ options['independent-tests'] = options['independent-tests'] ? options['independent-tests'].split(' ') : [];
+
+ var ms = parseInt(options['max-suites']);
+ if(ms) {
@Kami

Kami Oct 11, 2012

Member

style nit pick: space between if and opening parenthesis

Member

Kami commented Oct 11, 2012

+1 after you fix the minor style issues

@Kami Kami added a commit that referenced this pull request Oct 11, 2012

@Kami Kami Merge pull request #42 from sam-falvo/parallel_suites
Parallel suites
d957a56

@Kami Kami merged commit d957a56 into cloudkick:master Oct 11, 2012

1 check passed

default The Travis build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment