Skip to content
Browse files

deploy test passing

  • Loading branch information...
1 parent 8d264d5 commit e71d387b389c174b8f8e059dc9254bd593919228 @substack committed Mar 31, 2013
Showing with 18 additions and 11 deletions.
  1. +4 −0 index.js
  2. +1 −0 test/commit.sh
  3. +11 −8 test/deploy.js
  4. +2 −3 test/teardown.sh
View
4 index.js
@@ -171,6 +171,10 @@ Ploy.prototype.address = function () {
return this.bouncer.address.apply(this.bouncer, arguments);
};
+Ploy.prototype.close = function () {
+ this.bouncer.close();
+};
+
Ploy.prototype.handle = function (req, res) {
if (RegExp('^/_ploy/[^?]+\\.git\\b').test(req.url)) {
req.url = req.url.replace(RegExp('^/_ploy/'), '/');
View
1 test/commit.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+git checkout -b staging
sed -i 's/beep boop/rawr/g' server.js
git add server.js
git commit -m'rawr!'
View
19 test/deploy.js
@@ -14,9 +14,13 @@ function setup (t) {
function teardown (t) {
var ps = spawn(__dirname + '/teardown.sh', [], {
- cwd: __dirname + '/repo'
+ cwd: __dirname
});
+ ps.stderr.pipe(process.stderr);
ps.on('exit', t.end.bind(t));
+ t.on('end', function () {
+ setTimeout(process.exit, 500);
+ });
}
function commit (cb) {
@@ -38,14 +42,13 @@ function push (branch, cb) {
ps.on('exit', cb);
}
-var tmpDir = path.join('/tmp', Math.random());
+var tmpDir = '/tmp/ploy-test/' + Math.random();
var server = ploy(tmpDir);
var port;
-var request = require('request');
test(setup);
test(function (t) {
- t.plan(2);
+ t.plan(5);
server.listen(function () {
port = server.address().port;
setTimeout(push0, 2000);
@@ -55,24 +58,24 @@ test(function (t) {
push('master', function (code) {
t.equal(code, 0);
setTimeout(function () {
- verify('beep boop\n', 'localhost', deploy);
- }, 10 * 3000);
+ verify('beep boop\n', 'local', deploy);
+ }, 3000);
});
}
function push1 () {
push('staging', function (code) {
t.equal(code, 0);
setTimeout(function () {
- verify('oh hello\n', 'staging');
+ verify('rawr\n', 'staging.local');
}, 3000);
});
}
function deploy () {
commit(function (code) {
t.equal(code, 0);
- setTimeout(push1, 2000);
+ push1();
});
}
View
5 test/teardown.sh
@@ -1,5 +1,4 @@
#!/bin/bash
-if test $(basename $PWD)="repo" -a -d .git; then
- git revert -n $(git log | grep ^commit | tail -n1 | sed 's/^commit //')
- rm -rf .git
+if test $(basename $PWD)="test"; then
+ rm -rf repo
fi

0 comments on commit e71d387

Please sign in to comment.
Something went wrong with that request. Please try again.