Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog-entries/736.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Added heat-exchanger-simplified to system tests (new suite `heat_exchanger_simplified_test`). Improved Docker and Ubuntu 24.04 compatibility for local system test runs (Compose detection, precice user, build args, CalculiX download).
Empty file.
3 changes: 3 additions & 0 deletions tools/tests/components.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ calculix-adapter:
TUTORIALS_REF:
description: Tutorial git reference to use
default: "master"
PYTHON_BINDINGS_REF:
description: Git ref of the Python bindings (required when shared Dockerfile builds python_bindings stage)
default: "master"
CALCULIX_VERSION:
description: Version of Calculix to use
default: "2.20"
Expand Down
14 changes: 8 additions & 6 deletions tools/tests/dockerfiles/ubuntu_2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ FROM ubuntu:24.04 AS base_image
USER root
SHELL ["/bin/bash", "-c"]
ENV DEBIAN_FRONTEND=noninteractive
# We set a sensical value, but still have the possibilty to influence this via the build time arguments.
# We set a sensical value, but still have the possibilty to influence this via the build time arguments.
# When the dockerfile is built using the systemtests.py we set the PRECICE_UID and PRECICE_GID to the user executing the systemtests.
# This ensures no file ownership problems down the line and is the most easy fix, as we normally built the containers locally
# If not built via the systemtests.py its either possible to specify manually but 1000 would be the default anyway.
# 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.
ARG PRECICE_UID=1000
ARG PRECICE_GID=1000
RUN groupadd -g ${PRECICE_GID} precice && useradd -u ${PRECICE_UID} -g ${PRECICE_GID} -ms /bin/bash precice
RUN userdel ubuntu 2>/dev/null || true; groupdel ubuntu 2>/dev/null || true; \
groupadd -g ${PRECICE_GID} precice && useradd -u ${PRECICE_UID} -g ${PRECICE_GID} -ms /bin/bash precice
ENV PATH="${PATH}:/home/precice/.local/bin"
ENV LD_LIBRARY_PATH="/home/precice/.local/lib:${LD_LIBRARY_PATH}"
ENV CPATH="/home/precice/.local/include:$CPATH"
Expand Down Expand Up @@ -83,7 +85,7 @@ RUN git clone https://github.com/precice/openfoam-adapter.git &&\

FROM precice_dependecies AS python_bindings
COPY --from=precice /home/precice/.local/ /home/precice/.local/
ARG PYTHON_BINDINGS_REF
ARG PYTHON_BINDINGS_REF=master
USER precice
WORKDIR /home/precice
# Builds the precice python bindings for python3
Expand All @@ -100,7 +102,7 @@ RUN add-apt-repository -y ppa:fenics-packages/fenics && \
apt-get -qq update && \
apt-get -qq install --no-install-recommends fenics
USER precice
ARG FENICS_ADAPTER_REF
ARG FENICS_ADAPTER_REF=master
# Building fenics-adapter
RUN python3 -m venv --system-site-packages /home/precice/venv && \
. /home/precice/venv/bin/activate && \
Expand All @@ -123,9 +125,9 @@ RUN apt-get -qq update && \
apt-get -qq install libarpack2-dev libspooles-dev libyaml-cpp-dev
ARG CALCULIX_VERSION
USER precice
#Download Calculix
#Download Calculix (retry for transient DNS/network)
WORKDIR /home/precice
RUN wget http://www.dhondt.de/ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
RUN wget --tries=3 --retry-connrefused --timeout=30 http://www.dhondt.de/ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
tar xvjf ccx_${CALCULIX_VERSION}.src.tar.bz2 && \
rm -fv ccx_${CALCULIX_VERSION}.src.tar.bz2

Expand Down
62 changes: 45 additions & 17 deletions tools/tests/systemtests/Systemtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,36 @@
GLOBAL_TIMEOUT = 900
SHORT_TIMEOUT = 10

# Cached result of docker compose command detection
_DOCKER_COMPOSE_CMD = None


def _get_docker_compose_cmd():
"""Return the docker compose command list: either ['docker', 'compose'] or ['docker-compose']."""
global _DOCKER_COMPOSE_CMD
if _DOCKER_COMPOSE_CMD is not None:
return _DOCKER_COMPOSE_CMD
try:
subprocess.run(
['docker', 'compose', 'version'],
capture_output=True,
timeout=5,
check=True,
)
_DOCKER_COMPOSE_CMD = ['docker', 'compose']
except (subprocess.CalledProcessError, FileNotFoundError, subprocess.TimeoutExpired):
try:
subprocess.run(
['docker-compose', 'version'],
capture_output=True,
timeout=5,
check=True,
)
_DOCKER_COMPOSE_CMD = ['docker-compose']
except (subprocess.CalledProcessError, FileNotFoundError, subprocess.TimeoutExpired):
_DOCKER_COMPOSE_CMD = ['docker', 'compose'] # default; will fail with clear error
return _DOCKER_COMPOSE_CMD


def slugify(value, allow_unicode=False):
"""
Expand Down Expand Up @@ -381,13 +411,11 @@ def _run_field_compare(self):
file.write(docker_compose_content)
try:
# Execute docker-compose command
process = subprocess.Popen(['docker',
'compose',
'--file',
'docker-compose.field_compare.yaml',
'up',
'--exit-code-from',
'field-compare'],
cmd = _get_docker_compose_cmd() + [
'-f', 'docker-compose.field_compare.yaml',
'up', '--exit-code-from', 'field-compare'
]
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
start_new_session=True,
Expand Down Expand Up @@ -428,11 +456,11 @@ def _build_docker(self):

try:
# Execute docker-compose command
process = subprocess.Popen(['docker',
'compose',
'--file',
'docker-compose.tutorial.yaml',
'build'],
cmd = _get_docker_compose_cmd() + [
'-f', 'docker-compose.tutorial.yaml',
'build'
]
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
start_new_session=True,
Expand Down Expand Up @@ -472,11 +500,11 @@ def _run_tutorial(self):
stderr_data = []
try:
# Execute docker-compose command
process = subprocess.Popen(['docker',
'compose',
'--file',
'docker-compose.tutorial.yaml',
'up'],
cmd = _get_docker_compose_cmd() + [
'-f', 'docker-compose.tutorial.yaml',
'up'
]
process = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
start_new_session=True,
Expand Down
8 changes: 8 additions & 0 deletions tools/tests/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,14 @@ test_suites:
- fluid-cpp
- solid-python
reference_result: ./elastic-tube-1d/reference-results/fluid-cpp_solid-python.tar.gz
heat_exchanger_simplified_test:
tutorials:
- path: heat-exchanger-simplified
case_combination:
- fluid-top-openfoam
- fluid-btm-openfoam
- solid-calculix
reference_result: ./heat-exchanger-simplified/reference-results/fluid-top-openfoam_fluid-btm-openfoam_solid-calculix.tar.gz
release_test:
tutorials:
- path: elastic-tube-1d
Expand Down