Skip to content

Commit 4fab16a

Browse files
systemtests: add heat-exchanger-simplified test suite
Add heat-exchanger-simplified to the system test suites, covering the fluid-top-openfoam, fluid-btm-openfoam, solid-calculix case combination.
1 parent 1f54fc5 commit 4fab16a

6 files changed

Lines changed: 75 additions & 30 deletions

File tree

changelog-entries/731.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Added heat-exchanger-simplified to system tests: new standalone suite `heat_exchanger_simplified_test` and included in `release_test`. Fixed Docker compatibility for Ubuntu 24.04 (default ubuntu user removal with home dir cleanup, docker compose/docker-compose detection, ARG defaults for all adapter refs, wget retries for CalculiX and SU2 downloads).

heat-exchanger-simplified/reference-results/.gitkeep

Whitespace-only changes.

tools/tests/components.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ calculix-adapter:
117117
TUTORIALS_REF:
118118
description: Tutorial git reference to use
119119
default: "master"
120+
PYTHON_BINDINGS_REF:
121+
description: Git ref of the Python bindings (required when shared Dockerfile builds python_bindings stage)
122+
default: "master"
120123
CALCULIX_VERSION:
121124
description: Version of Calculix to use
122125
default: "2.20"

tools/tests/dockerfiles/ubuntu_2404/Dockerfile

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@ FROM ubuntu:24.04 AS base_image
22
USER root
33
SHELL ["/bin/bash", "-c"]
44
ENV DEBIAN_FRONTEND=noninteractive
5-
# We set a sensical value, but still have the possibilty to influence this via the build time arguments.
5+
# We set a sensical value, but still have the possibilty to influence this via the build time arguments.
66
# When the dockerfile is built using the systemtests.py we set the PRECICE_UID and PRECICE_GID to the user executing the systemtests.
77
# This ensures no file ownership problems down the line and is the most easy fix, as we normally built the containers locally
88
# If not built via the systemtests.py its either possible to specify manually but 1000 would be the default anyway.
99
ARG PRECICE_UID=1000
1010
ARG PRECICE_GID=1000
11-
RUN groupadd -g ${PRECICE_GID} precice && useradd -u ${PRECICE_UID} -g ${PRECICE_GID} -ms /bin/bash precice
11+
# Ubuntu 24.04+ images include a default user "ubuntu" with UID/GID 1000; remove it so we can create "precice" with the same UID/GID.
12+
RUN userdel -r ubuntu 2>/dev/null || true; groupdel ubuntu 2>/dev/null || true; \
13+
groupadd -g ${PRECICE_GID} precice && useradd -u ${PRECICE_UID} -g ${PRECICE_GID} -ms /bin/bash precice
1214
ENV PATH="${PATH}:/home/precice/.local/bin"
1315
ENV LD_LIBRARY_PATH="/home/precice/.local/lib:${LD_LIBRARY_PATH}"
1416
ENV CPATH="/home/precice/.local/include:$CPATH"
@@ -70,7 +72,7 @@ RUN apt-get update &&\
7072
USER precice
7173
COPY --from=precice /home/precice/.local/ /home/precice/.local/
7274
ARG OPENFOAM_ADAPTER_PR
73-
ARG OPENFOAM_ADAPTER_REF
75+
ARG OPENFOAM_ADAPTER_REF=master
7476
# Build the OpenFOAM adapter
7577
USER precice
7678
WORKDIR /home/precice
@@ -83,7 +85,7 @@ RUN git clone https://github.com/precice/openfoam-adapter.git &&\
8385

8486
FROM precice_dependecies AS python_bindings
8587
COPY --from=precice /home/precice/.local/ /home/precice/.local/
86-
ARG PYTHON_BINDINGS_REF
88+
ARG PYTHON_BINDINGS_REF=master
8789
USER precice
8890
WORKDIR /home/precice
8991
# Builds the precice python bindings for python3
@@ -100,7 +102,7 @@ RUN add-apt-repository -y ppa:fenics-packages/fenics && \
100102
apt-get -qq update && \
101103
apt-get -qq install --no-install-recommends fenics
102104
USER precice
103-
ARG FENICS_ADAPTER_REF
105+
ARG FENICS_ADAPTER_REF=master
104106
# Building fenics-adapter
105107
RUN python3 -m venv --system-site-packages /home/precice/venv && \
106108
. /home/precice/venv/bin/activate && \
@@ -125,12 +127,12 @@ ARG CALCULIX_VERSION
125127
USER precice
126128
#Download Calculix
127129
WORKDIR /home/precice
128-
RUN wget http://www.dhondt.de/ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
130+
RUN wget --tries=3 --retry-connrefused --timeout=30 http://www.dhondt.de/ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
129131
tar xvjf ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
130132
rm -fv ccx_${CALCULIX_VERSION}.src.tar.bz2
131133

132134
ARG CALCULIX_ADAPTER_PR
133-
ARG CALCULIX_ADAPTER_REF
135+
ARG CALCULIX_ADAPTER_REF=master
134136
WORKDIR /home/precice
135137
RUN git clone https://github.com/precice/calculix-adapter.git && \
136138
cd calculix-adapter && \
@@ -150,13 +152,13 @@ USER precice
150152
# Download and build SU2 (We could also use pre-built binaries from the SU2 releases)
151153
# The sed command applies a patch needed for Ubuntu 24.04.
152154
WORKDIR /home/precice
153-
RUN wget https://github.com/su2code/SU2/archive/refs/tags/v${SU2_VERSION}.tar.gz && \
155+
RUN wget --tries=3 --retry-connrefused --timeout=30 https://github.com/su2code/SU2/archive/refs/tags/v${SU2_VERSION}.tar.gz && \
154156
tar xvzf v${SU2_VERSION}.tar.gz && \
155157
rm -fv v${SU2_VERSION}.tar.gz
156158
RUN python3 -m venv /home/precice/venv && \
157159
. /home/precice/venv/bin/activate
158160
ARG SU2_ADAPTER_PR
159-
ARG SU2_ADAPTER_REF
161+
ARG SU2_ADAPTER_REF=master
160162
WORKDIR /home/precice
161163
ENV SU2_RUN="/home/precice/SU2_RUN"
162164
ENV SU2_HOME="/home/precice/SU2-${SU2_VERSION}"
@@ -179,7 +181,7 @@ RUN apt-get update &&\
179181
USER precice
180182
COPY --from=precice /home/precice/.local/ /home/precice/.local/
181183
ARG DEALII_ADAPTER_PR
182-
ARG DEALII_ADAPTER_REF
184+
ARG DEALII_ADAPTER_REF=master
183185
# Build the deal.II adapter
184186
USER precice
185187
WORKDIR /home/precice
@@ -189,4 +191,4 @@ RUN git clone https://github.com/precice/dealii-adapter.git &&\
189191
if [ -n "${DEALII_ADAPTER_PR}" ]; then git fetch origin pull/${DEALII_ADAPTER_PR}/head; fi && \
190192
git checkout ${DEALII_ADAPTER_REF} && \
191193
cmake . && \
192-
make -j $(nproc)
194+
make -j $(nproc)

tools/tests/systemtests/Systemtest.py

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,37 @@
1919
import os
2020

2121

22-
GLOBAL_TIMEOUT = 600
22+
GLOBAL_TIMEOUT = 900
2323
SHORT_TIMEOUT = 10
2424

2525

26+
# Cached result of docker compose command detection
27+
_DOCKER_COMPOSE_CMD = None
28+
29+
30+
def _get_docker_compose_cmd():
31+
"""Return the docker compose command list: ['docker', 'compose'] or ['docker-compose']."""
32+
global _DOCKER_COMPOSE_CMD
33+
if _DOCKER_COMPOSE_CMD is not None:
34+
return _DOCKER_COMPOSE_CMD
35+
try:
36+
subprocess.run(
37+
['docker', 'compose', 'version'],
38+
capture_output=True, timeout=5, check=True,
39+
)
40+
_DOCKER_COMPOSE_CMD = ['docker', 'compose']
41+
except (subprocess.CalledProcessError, FileNotFoundError, subprocess.TimeoutExpired):
42+
try:
43+
subprocess.run(
44+
['docker-compose', 'version'],
45+
capture_output=True, timeout=5, check=True,
46+
)
47+
_DOCKER_COMPOSE_CMD = ['docker-compose']
48+
except (subprocess.CalledProcessError, FileNotFoundError, subprocess.TimeoutExpired):
49+
_DOCKER_COMPOSE_CMD = ['docker', 'compose'] # default; will fail with clear error
50+
return _DOCKER_COMPOSE_CMD
51+
52+
2653
def slugify(value, allow_unicode=False):
2754
"""
2855
Taken from https://github.com/django/django/blob/master/django/utils/text.py
@@ -381,13 +408,11 @@ def _run_field_compare(self):
381408
file.write(docker_compose_content)
382409
try:
383410
# Execute docker-compose command
384-
process = subprocess.Popen(['docker',
385-
'compose',
386-
'--file',
387-
'docker-compose.field_compare.yaml',
388-
'up',
389-
'--exit-code-from',
390-
'field-compare'],
411+
cmd = _get_docker_compose_cmd() + [
412+
'-f', 'docker-compose.field_compare.yaml',
413+
'up', '--exit-code-from', 'field-compare'
414+
]
415+
process = subprocess.Popen(cmd,
391416
stdout=subprocess.PIPE,
392417
stderr=subprocess.PIPE,
393418
start_new_session=True,
@@ -428,11 +453,11 @@ def _build_docker(self):
428453

429454
try:
430455
# Execute docker-compose command
431-
process = subprocess.Popen(['docker',
432-
'compose',
433-
'--file',
434-
'docker-compose.tutorial.yaml',
435-
'build'],
456+
cmd = _get_docker_compose_cmd() + [
457+
'-f', 'docker-compose.tutorial.yaml',
458+
'build'
459+
]
460+
process = subprocess.Popen(cmd,
436461
stdout=subprocess.PIPE,
437462
stderr=subprocess.PIPE,
438463
start_new_session=True,
@@ -472,11 +497,11 @@ def _run_tutorial(self):
472497
stderr_data = []
473498
try:
474499
# Execute docker-compose command
475-
process = subprocess.Popen(['docker',
476-
'compose',
477-
'--file',
478-
'docker-compose.tutorial.yaml',
479-
'up'],
500+
cmd = _get_docker_compose_cmd() + [
501+
'-f', 'docker-compose.tutorial.yaml',
502+
'up'
503+
]
504+
process = subprocess.Popen(cmd,
480505
stdout=subprocess.PIPE,
481506
stderr=subprocess.PIPE,
482507
start_new_session=True,

tools/tests/tests.yaml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,4 +128,18 @@ test_suites:
128128
- fluid-openfoam
129129
- solid-upstream-dealii
130130
- solid-downstream-dealii
131-
reference_result: ./perpendicular-flap/reference-results/fluid-openfoam_solid-upstream-dealii_solid-downstream-dealii.tar.gz
131+
reference_result: ./perpendicular-flap/reference-results/fluid-openfoam_solid-upstream-dealii_solid-downstream-dealii.tar.gz
132+
- path: heat-exchanger-simplified
133+
case_combination:
134+
- fluid-top-openfoam
135+
- fluid-btm-openfoam
136+
- solid-calculix
137+
reference_result: ./heat-exchanger-simplified/reference-results/fluid-top-openfoam_fluid-btm-openfoam_solid-calculix.tar.gz
138+
heat_exchanger_simplified_test:
139+
tutorials:
140+
- path: heat-exchanger-simplified
141+
case_combination:
142+
- fluid-top-openfoam
143+
- fluid-btm-openfoam
144+
- solid-calculix
145+
reference_result: ./heat-exchanger-simplified/reference-results/fluid-top-openfoam_fluid-btm-openfoam_solid-calculix.tar.gz

0 commit comments

Comments
 (0)