Skip to content

Commit

Permalink
Switch from docker-compose to docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
jwodder committed Jul 23, 2024
1 parent f3d2f7f commit 76e7d14
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
31 changes: 24 additions & 7 deletions dandi/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -417,7 +428,8 @@ def docker_compose_setup() -> Iterator[dict[str, str]]:
)
run(
[
"docker-compose",
"docker",
"compose",
"run",
"--rm",
"-e",
Expand All @@ -436,7 +448,8 @@ def docker_compose_setup() -> Iterator[dict[str, str]]:

r = check_output(
[
"docker-compose",
"docker",
"compose",
"run",
"--rm",
"-T",
Expand All @@ -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,
Expand All @@ -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(

Check warning on line 492 in dandi/tests/fixtures.py

View check run for this annotation

Codecov / codecov/patch

dandi/tests/fixtures.py#L492

Added line #L492 was not covered by tests
["docker", "compose", "down", "-v"],
cwd=str(LOCAL_DOCKER_DIR),
check=True,
)


@dataclass
Expand Down
2 changes: 1 addition & 1 deletion dandi/tests/skip.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 76e7d14

Please sign in to comment.