Skip to content

Commit

Permalink
Add a trivial Python script to filter the tests and kill Meteor
Browse files Browse the repository at this point in the history
  • Loading branch information
paulproteus committed Aug 6, 2015
1 parent af7b27a commit 1cd2a01
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ before_install:
- sudo rsync -a $PWD/. /vagrant/.
# We run 'meteor' below first to do the user-specific install process...
- meteor --version
# We need Twisted for the silly Python script.
- sudo apt-get --quiet=2 -y install python-twisted
# ...and now we do the actual meteor run command.
script:
- bash .travis-run-tests.sh
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ action-run-tests: /usr/share/doc/python-requests /usr/share/doc/python-dnspython
cd sandcats && python integration_tests.py

action-run-unit-tests:
(cd sandcats ; tail --retry -f ./.meteor/local/log/jasmine-server-integration.log & (meteor --test --settings=dev-settings.json 2>&1 || true) | python ../meteor-testing-nonsense/input-filter.py )

action-run-unit-tests-continuously:
(cd sandcats ; tail --retry -f ./.meteor/local/log/jasmine-server-integration.log & meteor --test --settings=dev-settings.json )

/srv/sandcats/source/.git: /usr/share/doc/git
Expand Down
48 changes: 48 additions & 0 deletions meteor-testing-nonsense/input-filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/python
import sys
import os

from twisted.internet import stdio, reactor
from twisted.protocols import basic

class Echo(basic.LineReceiver):
from os import linesep as delimiter

def exitWithStatusCode(self):
print 'trying to exit'
if self.all_good:
os._exit(0)
else:
os._exit(1)

def _done(self):
print 'in _done'
os.system('killall -9 node')
reactor.removeAll()
reactor.stop()

def connectionMade(self):
self.all_good = True

def lineReceived(self, line):
self.sendLine(line)

if 'FAIL' in line:
self.all_good = False
self.sendLine("NOTICED A FAILURE!")
reactor.callLater(0.1, self._done)
print 'called later'

if 'time to exit' in line:
reactor.callLater(0.1, self._done)

def main():
e = Echo()
stdio.StandardIO(e)
from twisted.internet import reactor
reactor.run()
e.exitWithStatusCode()


if __name__ == '__main__':
main()
4 changes: 4 additions & 0 deletions sandcats/tests/jasmine/server/integration/RegisterSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ Jasmine.onTest(function () {

it('should return a signed certificate for the domain', function() {
});

it('time to exit', function() {
// See input-filter.py for the need for this. Sad but OK.
});
});
});
});

0 comments on commit 1cd2a01

Please sign in to comment.