Permalink
Browse files

Wait for test dependencies

  • Loading branch information...
1 parent 8cc1c41 commit 6e08c252be933c93eb0b578e6cb50418f3e16d6c @andresriancho committed Sep 13, 2015
Showing with 36 additions and 0 deletions.
  1. +1 −0 circle.yml
  2. +35 −0 w3af/tests/waitfor-test-dependencies.py
View
@@ -66,6 +66,7 @@ dependencies:
# Run the test servers/dependencies
- cd w3af/tests/ && docker-compose up -d
- w3af/tests/add-test-routes.sh
+ - w3af/tests/waitfor-test-dependencies.py
post:
- pip --version
@@ -0,0 +1,35 @@
+import sys
+import time
+import urllib2
+
+LOOPS = 25
+DELAY = 1
+
+TEST_DEPENDENCIES = ['http://127.0.0.1:8000',
+ 'https://127.0.0.1:8001',
+ 'http://127.0.0.1:8899',
+ 'http://127.0.0.1:9008',
+ 'http://127.0.0.1:9009',
+ 'http://127.0.0.1:8998',
+ 'http://127.0.0.1:8098']
+
+is_available = []
+
+for _ in xrange(LOOPS):
+ time.sleep(DELAY)
+
+ for url in TEST_DEPENDENCIES:
+ if url in is_available:
+ continue
+
+ try:
+ urllib2.urlopen(url)
+ except Exception, e:
+ print('%s is offline (%s)' % (url, e.__class__.__name__))
+ else:
+ print('%s is ready' % url)
+ is_available.append(url)
+
+if len(is_available) != len(TEST_DEPENDENCIES):
+ print('Timeout waiting for test dependencies!')
+ sys.exit(1)

0 comments on commit 6e08c25

Please sign in to comment.