def test_api_validated(self): limit = 60 while Api().noResponse('http://'+ self.ip +':80/carts/579f21ae98684924944651bf'): if limit == 0: self.fail("Couldn't get the API running") limit = limit - 1 sleep(1) out = Dredd().test_against_endpoint("carts", "http://cart/", links=[self.mongo_container_name, self.container_name], env=[("MONGO_ENDPOINT", "mongodb://cart-db:27017/data")]) self.assertGreater(out.find("0 failing"), -1) self.assertGreater(out.find("0 errors"), -1)
def test_api_validated(self): limit = 30 while Api().noResponse('http://' + self.ip + ':80/payments/'): if limit == 0: self.fail("Couldn't get the API running") limit = limit - 1 sleep(1) out = Dredd().test_against_endpoint("payment", 'http://' + self.ip + ':80/', links=[self.container_name], dump_streams=True) self.assertGreater(out.find("0 failing"), -1) self.assertGreater(out.find("0 errors"), -1)
def test_api_validated(self): limit = 30 while Api().noResponse('http://' + self.ip + ':80/orders'): if limit == 0: self.fail("Couldn't get the API running") limit = limit - 1 sleep(1) out = Dredd().test_against_endpoint( "orders", 'http://' + self.ip + ':80/', links=[self.mongo_container_name, self.container_name], env=[("MONGO_ENDPOINT", "mongodb://orders-db:27017/data")], dump_streams=True) self.assertGreater(out.find("0 failing"), -1) self.assertGreater(out.find("0 errors"), -1) print(out)
def test_api_validated(self): limit = 30 url = f'http://{self.ip}:{PaymentContainerTest.PORT}/' while Api().noResponse(url + 'payments/'): if limit == 0: self.fail("Couldn't get the API running") limit = limit - 1 sleep(1) out = Dredd().test_against_endpoint("payment", url, links=[self.container_name], dump_streams=True) self.assertGreater(out.find("0 failing"), -1) self.assertGreater(out.find("0 errors"), -1)
def setUp(self): command = [ 'docker', 'run', '-d', '--name', CatalogueApplicationTest.container_name, '-h', CatalogueApplicationTest.container_name, 'weaveworksdemos/catalogue:' + self.TAG ] self.docker.execute(command) self.ip = self.docker.get_container_ip( CatalogueApplicationTest.container_name) command = [ 'docker', 'run', '-d', '--link', 'catalogue', '--name', "front-end", '-h', "front-end", 'weaveworksdemos/front-end:' + self.TAG ] self.docker.execute(command) self.front_end_ip = self.docker.get_container_ip("front-end") while Api().noResponse('http://' + self.front_end_ip + ':8079'): sleep(1)
def test_api_validated(self): print("+Entering test api validated") print("+self.ip: " + self.ip) limit = 30 while Api().noResponse('http://' + self.ip + ':80/orders'): if limit == 0: self.fail("Couldn't get the API running") limit = limit - 1 sleep(1) print("+self.ip: " + self.ip) out = Dredd().test_against_endpoint( "orders-aws", 'http://' + self.ip + ':80/', links=[self.dynamodb_container_name, self.container_name], env=[("AWS_DYNAMODB_ENDPOINT", "http://orders-db:8080"), ("AWS_ACCESS_KEY", "foo"), ("AWS_SECRET_KEY", "bar"), ("PORT", "80")], dump_streams=True) self.assertGreater(out.find("0 failing"), -1) self.assertGreater(out.find("0 errors"), -1) print(out)
def wait_or_fail(self, endpoint, limit=20): while Api().noResponse(endpoint): if limit == 0: self.fail("Couldn't get the API running") limit = limit - 1 sleep(1)