diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8089a536..9e940a6ae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -115,14 +115,14 @@ jobs: - name: Dump Docker Compose logs if: failure() && startsWith(matrix.os, 'ubuntu') run: | - docker-compose \ + docker compose \ -f dandi/tests/data/dandiarchive-docker/docker-compose.yml \ logs --timestamps - name: Shut down Docker Compose if: startsWith(matrix.os, 'ubuntu') run: | - docker-compose \ + docker compose \ -f dandi/tests/data/dandiarchive-docker/docker-compose.yml \ down -v diff --git a/dandi/tests/data/dandiarchive-docker/docker-compose.yml b/dandi/tests/data/dandiarchive-docker/docker-compose.yml index c128113ce..5a9e75d85 100644 --- a/dandi/tests/data/dandiarchive-docker/docker-compose.yml +++ b/dandi/tests/data/dandiarchive-docker/docker-compose.yml @@ -36,11 +36,10 @@ services: DJANGO_DANDI_WEB_APP_URL: http://localhost:8085 DJANGO_DANDI_API_URL: http://localhost:8000 DJANGO_DANDI_JUPYTERHUB_URL: https://hub.dandiarchive.org - DJANGO_DANDI_DEV_EMAIL: test@example.com - DANDI_ALLOW_LOCALHOST_URLS: "1" DJANGO_DANDI_DEV_EMAIL: "test@example.com" + DANDI_ALLOW_LOCALHOST_URLS: "1" ports: - - "8000:8000" + - "127.0.0.1:8000:8000" celery: image: dandiarchive/dandiarchive-api @@ -81,8 +80,8 @@ services: DJANGO_DANDI_WEB_APP_URL: http://localhost:8085 DJANGO_DANDI_API_URL: http://localhost:8000 DJANGO_DANDI_JUPYTERHUB_URL: https://hub.dandiarchive.org - DANDI_ALLOW_LOCALHOST_URLS: "1" DJANGO_DANDI_DEV_EMAIL: "test@example.com" + DANDI_ALLOW_LOCALHOST_URLS: "1" minio: image: minio/minio:RELEASE.2022-04-12T06-55-35Z @@ -90,7 +89,7 @@ services: tty: true command: ["server", "/data"] ports: - - "9000:9000" + - "127.0.0.1:9000:9000" environment: MINIO_ACCESS_KEY: minioAccessKey MINIO_SECRET_KEY: minioSecretKey @@ -105,8 +104,8 @@ services: POSTGRES_DB: django POSTGRES_PASSWORD: postgres image: postgres - ports: - - "5432:5432" + expose: + - "5432" healthcheck: test: ["CMD", "pg_isready", "-U", "postgres"] interval: 7s @@ -115,5 +114,5 @@ services: rabbitmq: image: rabbitmq:management - ports: - - "5672:5672" + expose: + - "5672" diff --git a/dandi/tests/fixtures.py b/dandi/tests/fixtures.py index f27e1dcea..9fe097154 100644 --- a/dandi/tests/fixtures.py +++ b/dandi/tests/fixtures.py @@ -395,16 +395,27 @@ def docker_compose_setup() -> Iterator[dict[str, str]]: try: if create: if os.environ.get("DANDI_TESTS_PULL_DOCKER_COMPOSE", "1") not in ("", "0"): - run(["docker-compose", "pull"], cwd=str(LOCAL_DOCKER_DIR), check=True) + run( + ["docker", "compose", "pull"], cwd=str(LOCAL_DOCKER_DIR), check=True + ) run( - ["docker-compose", "run", "--rm", "django", "./manage.py", "migrate"], + [ + "docker", + "compose", + "run", + "--rm", + "django", + "./manage.py", + "migrate", + ], cwd=str(LOCAL_DOCKER_DIR), env=env, check=True, ) run( [ - "docker-compose", + "docker", + "compose", "run", "--rm", "django", @@ -417,7 +428,8 @@ def docker_compose_setup() -> Iterator[dict[str, str]]: ) run( [ - "docker-compose", + "docker", + "compose", "run", "--rm", "-e", @@ -436,7 +448,8 @@ def docker_compose_setup() -> Iterator[dict[str, str]]: r = check_output( [ - "docker-compose", + "docker", + "compose", "run", "--rm", "-T", @@ -458,7 +471,7 @@ def docker_compose_setup() -> Iterator[dict[str, str]]: if create: run( - ["docker-compose", "up", "-d", "django", "celery"], + ["docker", "compose", "up", "-d", "django", "celery"], cwd=str(LOCAL_DOCKER_DIR), env=env, check=True, @@ -476,7 +489,11 @@ def docker_compose_setup() -> Iterator[dict[str, str]]: yield {"django_api_key": django_api_key} finally: if persist in (None, "0"): - run(["docker-compose", "down", "-v"], cwd=str(LOCAL_DOCKER_DIR), check=True) + run( + ["docker", "compose", "down", "-v"], + cwd=str(LOCAL_DOCKER_DIR), + check=True, + ) @dataclass diff --git a/dandi/tests/skip.py b/dandi/tests/skip.py index 0e08b5f99..54d864b76 100644 --- a/dandi/tests/skip.py +++ b/dandi/tests/skip.py @@ -101,7 +101,7 @@ def windows(): def no_docker_commands(): missing_cmds = [] - for cmd in ("docker", "docker-compose"): + for cmd in ("docker",): if shutil.which(cmd) is None: missing_cmds.append(cmd) msg = "missing Docker commands: {}".format(", ".join(missing_cmds))