Skip to content

Commit ce982b3

Browse files
committed
Dockerized testing updates
1 parent dda0ab3 commit ce982b3

13 files changed

Lines changed: 55 additions & 12 deletions

tests/test_helpers.py

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,39 @@ def _install_WfCommons_on_container(container):
4040
tar_data = _make_tarfile_of_wfcommons()
4141
container.put_archive(target_path, tar_data)
4242
# Cleanup files that came from the host
43-
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/build/", stdout=True, stderr=True)
44-
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/*.egg-info/", stdout=True, stderr=True)
43+
exit_code, output = container.exec_run("/bin/rm -rf /tmp/WfCommons/build/", user="root", stdout=True, stderr=True)
44+
exit_code, output = container.exec_run("/bin/rm -rf /tmp/WfCommons/*.egg-info/", user="root", stdout=True, stderr=True)
4545
# Clean up and force a rebuild of cpu-benchmark (because it may be compiled for the wrong architecture)
46-
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark.o", stdout=True,
46+
exit_code, output = container.exec_run("/bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark.o", user="root", stdout=True,
4747
stderr=True)
48-
exit_code, output = container.exec_run("sudo /bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark", stdout=True,
48+
exit_code, output = container.exec_run("/bin/rm -rf /tmp/WfCommons/bin/cpu-benchmark", user="root", stdout=True,
4949
stderr=True)
5050

5151
# Install WfCommons on the container (to install wfbench and cpu-benchmark really)
52-
exit_code, output = container.exec_run("sudo python3 -m pip install . --break-system-packages",
52+
exit_code, output = container.exec_run("python3 -m pip install . --break-system-packages",
53+
user="root",
5354
workdir="/tmp/WfCommons", stdout=True, stderr=True)
54-
# print(output.decode())
5555
if exit_code != 0:
56-
raise RuntimeError("Failed to install WfCommons on the container")
56+
print(output.decode())
57+
raise RuntimeError("Failed to pip install WfCommons on the container")
58+
59+
# Copy the ~/.local directory to /home/wfcommons/, because the path
60+
# is /home/wfcommons (because this current Docker user may be unknown a priori)
61+
# This is hack, and requires that the /home/wfcommons directory be world-read-write-exec,
62+
# but who cares, these are containers!
63+
64+
# exit_code, output = container.exec_run(
65+
# ["sh", "-c", "whoami"],
66+
# stdout=True, stderr=True)
67+
# print(f"WHOAMI: {output.decode()}")
68+
# exit_code, output = container.exec_run(
69+
# ["sh", "-c", "ls /home/wfcommons/.local"],
70+
# stdout=True, stderr=True)
71+
# print(f"LS /home/wfcommons/.local : {output.decode()}")
72+
# exit_code, output = container.exec_run(
73+
# ["sh", "-c", "cp -r /.local /home/wfcommons/"],
74+
# stdout=True, stderr=True)
75+
5776

5877
def _start_docker_container(backend, mounted_dir, working_dir, bin_dir, command=None):
5978
if command is None:

tests/translators_loggers/Dockerfile.airflow

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
7777
ENV PATH="$PATH:/home/wfcommons/.local/bin/"
7878

7979
USER wfcommons
80-
WORKDIR /home/wfcommons
80+
WORKDIR /home/wfcommons
81+
# Making this directory world rwx to facilitate testing
82+
RUN chmod -R 777 /home/wfcommons
83+

tests/translators_loggers/Dockerfile.bash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4242

4343
USER wfcommons
4444
WORKDIR /home/wfcommons
45+
# Making this directory world rwx to facilitate testing
46+
RUN chmod -R 777 /home/wfcommons
4547

tests/translators_loggers/Dockerfile.cwl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4646

4747
USER wfcommons
4848
WORKDIR /home/wfcommons
49+
# Making this directory world rwx to facilitate testing
50+
RUN chmod -R 777 /home/wfcommons
4951

tests/translators_loggers/Dockerfile.dask

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4646

4747
USER wfcommons
4848
WORKDIR /home/wfcommons
49+
# Making this directory world rwx to facilitate testing
50+
RUN chmod -R 777 /home/wfcommons
4951

tests/translators_loggers/Dockerfile.makeflow

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4343

4444
USER wfcommons
4545
WORKDIR /home/wfcommons
46+
# Making this directory world rwx to facilitate testing
47+
RUN chmod -R 777 /home/wfcommons
48+
4649

4750
# Install Miniforge
4851
RUN wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" && \

tests/translators_loggers/Dockerfile.nextflow

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
4545
ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4646
USER wfcommons
4747
WORKDIR /home/wfcommons
48+
# Making this directory world rwx to facilitate testing
49+
RUN chmod -R 777 /home/wfcommons
50+
4851

4952
# Install Nextflow and dependencies
5053
RUN curl -s https://get.nextflow.io | bash && sudo mv ./nextflow /usr/local/bin/

tests/translators_loggers/Dockerfile.parsl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
4545

4646
USER wfcommons
4747
WORKDIR /home/wfcommons
48+
# Making this directory world rwx to facilitate testing
49+
RUN chmod -R 777 /home/wfcommons
4850

tests/translators_loggers/Dockerfile.pegasus

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
110110

111111
USER wfcommons
112112
WORKDIR /home/wfcommons
113+
# Making this directory world rwx to facilitate testing
114+
RUN chmod -R 777 /home/wfcommons
115+
113116

114117
# Create script to start HTCondor
115118
RUN echo "#!/bin/bash" >> ./start_condor.sh && \

tests/translators_loggers/Dockerfile.pycompss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,6 @@ ENV PATH="$PATH:/home/wfcommons/.local/bin/"
5151

5252
USER wfcommons
5353
WORKDIR /home/wfcommons
54+
# Making this directory world rwx to facilitate testing
55+
RUN chmod -R 777 /home/wfcommons
5456

0 commit comments

Comments
 (0)