This repository has been archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- when-prewarmed utility added to ensure we wait until the starting daemon is ready - cleaned up test cases - improved test case prewarm integration - increased jvm memory
- Loading branch information
Showing
15 changed files
with
190 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
#!/bin/bash | ||
|
||
echo "loading" > /workspace/prewarm.status | ||
|
||
# prewarm by starting the gradle daemon. Running an initial test build will also speed things up a bit | ||
cd /runner/frameworks/gradle && gradle --daemon --offline test | ||
|
||
echo "loaded" > /workspace/prewarm.status | ||
|
||
echo "prewarmed" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
const fs = require('fs-extra'); | ||
const execSync = require('child_process').execSync; | ||
|
||
const statusPath = "/home/codewarrior/prewarm.status"; | ||
|
||
/** | ||
* If the prewarming process is in-process, we want to wait until it finishes, otherwise in the case of things like waiting | ||
* for Gradle, two builds happen and that will kill performance and the process will likely fail due to a timeout. | ||
* @param cb Function callback. True will be passed to the callback if the prewarm happened, which | ||
* will indicate that the deamon should have been started. | ||
*/ | ||
function whenPrewarmed(opts, cb, notified) { | ||
if (!fs.pathExistsSync(statusPath)) { | ||
cb(false); | ||
} | ||
else if (fs.readFileSync(statusPath).toString().indexOf('loaded') === 0) { | ||
cb(true); | ||
} | ||
else { | ||
if (!notified && opts.publish) { | ||
opts.publish('status', 'Waiting for prewarming to finish...'); | ||
} | ||
setTimeout(() => whenPrewarmed(opts, cb, true), 200); | ||
} | ||
} | ||
|
||
// used by specs to ensure the daemon is prewarmed | ||
function ensure(done, shPath = "/runner/prewarm.sh") { | ||
if (!fs.pathExistsSync(statusPath)) { | ||
console.log("Starting daemon with test run to ensure tests run within their allowed time..."); | ||
console.log(execSync(`sh ${shPath}`).toString()); | ||
done(); | ||
} | ||
else { | ||
whenPrewarmed({}, done); | ||
} | ||
} | ||
|
||
function clean() { | ||
execSync(`rm -rf ${statusPath}`); | ||
execSync(`gradle --stop`); | ||
} | ||
|
||
module.exports = whenPrewarmed; | ||
module.exports.ensure = ensure; | ||
module.exports.clean = clean; | ||
|
||
// sets up mocha, also ensures that done never gets called with an argument | ||
module.exports.setupMocha = function() { | ||
before(done => ensure(_ => done())); | ||
after(done => clean(_ => done())); | ||
} |
Oops, something went wrong.