Commit d88b4700 authored by Aleksandr Guljajev's avatar Aleksandr Guljajev

Fixing deadlock

parent aa3c1aec
......@@ -10,6 +10,7 @@ from util.Dredd import Dredd
class CartContainerTest(unittest.TestCase):
TAG = "latest"
COMMIT = ""
container_name = Docker().random_container_name('cart')
mongo_container_name = Docker().random_container_name('cart-db')
def __init__(self, methodName='runTest'):
......@@ -24,7 +25,7 @@ class CartContainerTest(unittest.TestCase):
'-h', 'cart',
'--link',
CartContainerTest.mongo_container_name,
'weaveworksdemos/cart:' + self.TAG]
'weaveworksdemos/cart:' + self.COMMIT]
Docker().execute(command)
self.ip = Docker().get_container_ip(CartContainerTest.container_name)
......@@ -51,16 +52,16 @@ class CartContainerTest(unittest.TestCase):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--tag', default="latest", help='The tag of the image to use. (default: latest)')
default_tag = "latest"
parser.add_argument('--tag', default=default_tag, help='The tag of the image to use. (default: latest)')
parser.add_argument('unittest_args', nargs='*')
args = parser.parse_args()
CartContainerTest.TAG = args.tag
try:
CartContainerTest.TAG = os.environ["TAG"]
except KeyError as e:
pass
if CartContainerTest.TAG == "":
CartContainerTest.TAG = default_tag
CartContainerTest.COMMIT = os.environ["COMMIT"]
# Now set the sys.argv to the unittest_args (leaving sys.argv[0] alone)
sys.argv[1:] = args.unittest_args
unittest.main()
......@@ -31,5 +31,6 @@ $DOCKER_CMD run \
-e TRAVIS_PULL_REQUEST=$TRAVIS_PULL_REQUEST \
-e TRAVIS=$TRAVIS \
-e TAG=$TAG \
-e COMMIT=$COMMIT \
test-container \
sh -c "export PYTHONPATH=\$PYTHONPATH:\$PWD/test ; python test/$@"
......@@ -28,11 +28,7 @@ class Docker:
def execute(self, command, dump_streams=False):
print("Running: " + ' '.join(command))
p = Popen(command, stdout=PIPE, stderr=PIPE)
p.wait()
out = p.stdout.read()
err = p.stderr.read()
p.stdout.close()
p.stderr.close()
out, err = p.communicate()
if dump_streams == True:
print(out.decode('utf-8'))
print(err.decode('utf-8'))
......
......@@ -4,7 +4,7 @@ import os
import unittest
class Dredd:
image = 'weaveworksdemos/openapi'
image = 'weaveworksdemos/openapi:snapshot'
container_name = ''
def test_against_endpoint(self, service, api_endpoint, links=[], env=[], dump_streams=False):
self.container_name = Docker().random_container_name('openapi')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment