From 61624b6e75c5693ca4a04a1d3b00277c2696ed26 Mon Sep 17 00:00:00 2001 From: Thomas Sileo Date: Fri, 5 Apr 2019 20:03:49 +0200 Subject: [PATCH] Fix tests --- app.py | 3 ++- docker-compose-tests.yml | 3 ++- poussetaches.py | 2 +- tests/federation_test.py | 3 +-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app.py b/app.py index 34894a6..4e3ef0b 100644 --- a/app.py +++ b/app.py @@ -88,7 +88,8 @@ from utils.media import Kind from poussetaches import PousseTaches -p = PousseTaches("http://poussetaches:7991", "http://web:5005") +phost = "http://" + os.getenv("COMPOSE_PROJECT_NAME", "") +p = PousseTaches(f"{phost}_poussetaches_1:7991", f"{phost}_web_1:5005") back = activitypub.MicroblogPubBackend() diff --git a/docker-compose-tests.yml b/docker-compose-tests.yml index 5d93b0e..fc94f79 100644 --- a/docker-compose-tests.yml +++ b/docker-compose-tests.yml @@ -9,8 +9,9 @@ services: - "./static:/app/static" environment: - MICROBLOGPUB_AMQP_BROKER=pyamqp://guest@rmq// - - MICROBLOGPUB_MONGODB_HOST=mongo:27017 + - MICROBLOGPUB_MONGODB_HOST=${COMPOSE_PROJECT_NAME}_mongo_1:27017 - MICROBLOGPUB_DEBUG=1 + - COMPOSE_PROJECT_NAME=${COMPOSE_PROJECT_NAME} - POUSSETACHES_AUTH_KEY=123 celery: # image: "instance1_web" diff --git a/poussetaches.py b/poussetaches.py index ea989b6..6bf9180 100644 --- a/poussetaches.py +++ b/poussetaches.py @@ -45,4 +45,4 @@ class PousseTaches: print(f"envelope={envelope!r}") payload = json.loads(base64.b64decode(envelope["payload"])) - return Task(req_id=envelope["req_id"], tries=envelope["tries"], payload=payload) + return Task(req_id=envelope["req_id"], tries=envelope["tries"], payload=payload) # type: ignore diff --git a/tests/federation_test.py b/tests/federation_test.py index bdaf58d..959280f 100644 --- a/tests/federation_test.py +++ b/tests/federation_test.py @@ -19,7 +19,7 @@ class Instance(object): def __init__(self, name, host_url, docker_url=None): self.host_url = host_url self.docker_url = docker_url or host_url - self._create_delay = 60 + self._create_delay = 15 with open( os.path.join( os.path.dirname(os.path.abspath(__file__)), @@ -50,7 +50,6 @@ class Instance(object): def debug(self): """Returns the debug infos (number of items in the inbox/outbox.""" - time.sleep(self._create_delay) resp = requests.get( f"{self.host_url}/api/debug", headers={**self._auth_headers, "Accept": "application/json"},