Skip to content

Commit

Permalink
fix incompatibilities with recent docker compose versions
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Nov 22, 2023
1 parent bf6809e commit d9e5b5d
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 8 deletions.
15 changes: 15 additions & 0 deletions empty.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CLIENT_PARAMS=""
CERTS=""
CRON=""
DOWNLOADS=""
IPERF_CONGESTION=""
QLOGDIR=""
REQUESTS=""
SCENARIO=""
SERVER_PARAMS=""
SSLKEYLOGFILE=""
TESTCASE_CLIENT=""
TESTCASE_SERVER=""
VERSION=""
WWW=""
WAITFORSERVER=""
25 changes: 17 additions & 8 deletions interop.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ def _check_impl_is_compliant(self, name: str) -> bool:
"DOWNLOADS=" + downloads_dir.name + " "
'SCENARIO="simple-p2p --delay=15ms --bandwidth=10Mbps --queue=25" '
"CLIENT=" + self._implementations[name]["image"] + " "
"docker-compose up --timeout 0 --abort-on-container-exit -V sim client"
"SERVER="
+ self._implementations[name]["image"]
+ " " # only needed so docker compose doesn't complain
"docker compose --env-file empty.env up --timeout 0 --abort-on-container-exit -V sim client"
)
output = subprocess.run(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
Expand All @@ -152,8 +155,11 @@ def _check_impl_is_compliant(self, name: str) -> bool:
"CLIENT_LOGS=/dev/null "
"WWW=" + www_dir.name + " "
"DOWNLOADS=" + downloads_dir.name + " "
"CLIENT="
+ self._implementations[name]["image"]
+ " " # only needed so docker compose doesn't complain
"SERVER=" + self._implementations[name]["image"] + " "
"docker-compose up -V server"
"docker compose --env-file empty.env up -V server"
)
output = subprocess.run(
cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT
Expand Down Expand Up @@ -285,11 +291,14 @@ def _export_results(self):
f.close()

def _copy_logs(self, container: str, dir: tempfile.TemporaryDirectory):
r = subprocess.run(
'docker cp "$(docker-compose --log-level ERROR ps -q '
cmd = (
"docker cp \"$(docker ps -a --format '{{.ID}} {{.Names}}' | awk '/^.* "
+ container
+ ')":/logs/. '
+ dir.name,
+ "$/ {print $1}')\":/logs/. "
+ dir.name
)
r = subprocess.run(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down Expand Up @@ -358,7 +367,7 @@ def _run_test(
containers = "sim client server " + " ".join(testcase.additional_containers())
cmd = (
params
+ " docker-compose up --abort-on-container-exit --timeout 1 "
+ " docker compose --env-file empty.env up --abort-on-container-exit --timeout 1 "
+ containers
)
logging.debug("Command: %s", cmd)
Expand All @@ -384,7 +393,7 @@ def _run_test(
if expired:
logging.debug("Test failed: took longer than %ds.", testcase.timeout())
r = subprocess.run(
"docker-compose stop " + containers,
"docker compose --env-file empty.env stop " + containers,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
Expand Down

0 comments on commit d9e5b5d

Please sign in to comment.