From de54a88693eaffd3d3eedd8d0bcc2bb1a90ef4f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Diot?= Date: Fri, 27 Dec 2024 11:02:44 +0100 Subject: [PATCH] Replace 'docker-compose' with 'docker compose' in test scripts for consistency with updated Docker CLI commands --- tests/AutoconfTest.py | 26 +++++++++++++------------- tests/DockerTest.py | 14 +++++++------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/AutoconfTest.py b/tests/AutoconfTest.py index 458916865..423ec395d 100644 --- a/tests/AutoconfTest.py +++ b/tests/AutoconfTest.py @@ -65,15 +65,15 @@ class AutoconfTest(Test): with open(compose, "w") as f: f.write(dump(data)) proc = run( - "docker-compose pull --ignore-pull-failures", + "docker compose pull --ignore-pull-failures", cwd="/tmp/autoconf", shell=True, ) if proc.returncode != 0: - raise (Exception("docker-compose pull failed (autoconf stack)")) - proc = run("docker-compose up -d", cwd="/tmp/autoconf", shell=True) + raise (Exception("docker compose pull failed (autoconf stack)")) + proc = run("docker compose up -d", cwd="/tmp/autoconf", shell=True) if proc.returncode != 0: - raise (Exception("docker-compose up failed (autoconf stack)")) + raise (Exception("docker compose up failed (autoconf stack)")) i = 0 healthy = False while i < 30: @@ -107,7 +107,7 @@ class AutoconfTest(Test): try: if not Test.end(): return False - proc = run("docker-compose down -v", cwd="/tmp/autoconf", shell=True) + proc = run("docker compose down -v", cwd="/tmp/autoconf", shell=True) if proc.returncode != 0: ret = False rmtree("/tmp/autoconf") @@ -165,15 +165,15 @@ class AutoconfTest(Test): if proc.returncode != 0: raise (Exception("cp bw-data failed")) proc = run( - "docker-compose -f autoconf.yml pull --ignore-pull-failures", + "docker compose -f autoconf.yml pull --ignore-pull-failures", shell=True, cwd=test, ) if proc.returncode != 0: - raise (Exception("docker-compose pull failed")) - proc = run("docker-compose -f autoconf.yml up -d", shell=True, cwd=test) + raise (Exception("docker compose pull failed")) + proc = run("docker compose -f autoconf.yml up -d", shell=True, cwd=test) if proc.returncode != 0: - raise (Exception("docker-compose up failed")) + raise (Exception("docker compose up failed")) except: log( "AUTOCONF", @@ -187,9 +187,9 @@ class AutoconfTest(Test): def _cleanup_test(self): try: test = f"/tmp/tests/{self._name}" - proc = run("docker-compose -f autoconf.yml down -v", shell=True, cwd=test) + proc = run("docker compose -f autoconf.yml down -v", shell=True, cwd=test) if proc.returncode != 0: - raise (Exception("docker-compose down failed")) + raise (Exception("docker compose down failed")) proc = run( "sudo bash -c 'rm -rf /tmp/www/*'", shell=True, @@ -208,6 +208,6 @@ class AutoconfTest(Test): def _debug_fail(self): autoconf = "/tmp/autoconf" - run("docker-compose logs", shell=True, cwd=autoconf) + run("docker compose logs", shell=True, cwd=autoconf) test = f"/tmp/tests/{self._name}" - run("docker-compose -f autoconf.yml logs", shell=True, cwd=test) + run("docker compose -f autoconf.yml logs", shell=True, cwd=test) diff --git a/tests/DockerTest.py b/tests/DockerTest.py index aa5a034ff..d58a38cd9 100644 --- a/tests/DockerTest.py +++ b/tests/DockerTest.py @@ -80,12 +80,12 @@ class DockerTest(Test): ) if proc.returncode != 0: raise (Exception("cp bw-data failed")) - proc = run("docker-compose pull --ignore-pull-failures", shell=True, cwd=test) + proc = run("docker compose pull --ignore-pull-failures", shell=True, cwd=test) if proc.returncode != 0: - raise (Exception("docker-compose pull failed")) - proc = run("docker-compose up -d", shell=True, cwd=test) + raise (Exception("docker compose pull failed")) + proc = run("docker compose up -d", shell=True, cwd=test) if proc.returncode != 0: - raise (Exception("docker-compose up failed")) + raise (Exception("docker compose up failed")) except: log( "DOCKER", @@ -99,9 +99,9 @@ class DockerTest(Test): def _cleanup_test(self): try: test = "/tmp/tests/" + self._name - proc = run("docker-compose down -v", shell=True, cwd=test) + proc = run("docker compose down -v", shell=True, cwd=test) if proc.returncode != 0: - raise (Exception("docker-compose down failed")) + raise (Exception("docker compose down failed")) super()._cleanup_test() except: log( @@ -114,4 +114,4 @@ class DockerTest(Test): def _debug_fail(self): test = "/tmp/tests/" + self._name - run("docker-compose logs", shell=True, cwd=test) + run("docker compose logs", shell=True, cwd=test)