From 2a4f9350bc3dd1a29c1e8f8907a299b498a12552 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 25 Feb 2022 15:05:17 -0500 Subject: [PATCH 1/2] ENH: add scripts to start IOCs in a pod + run tests in pod --- scripts/epics_pod.sh | 46 ++++++++++++++++++++++++++++++++++++++++++ scripts/test_in_pod.sh | 5 +++++ 2 files changed, 51 insertions(+) create mode 100755 scripts/epics_pod.sh create mode 100755 scripts/test_in_pod.sh diff --git a/scripts/epics_pod.sh b/scripts/epics_pod.sh new file mode 100755 index 000000000..c75b0edd1 --- /dev/null +++ b/scripts/epics_pod.sh @@ -0,0 +1,46 @@ +#! /usr/bin/bash +set -e +set -o xtrace + + +SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +MOTOR_DOCKERIMAGE="docker.io/nsls2/epics-docker:latest" +PE_DOCKERIMAGE="docker.io/nsls2/pyepics-docker:latest" +AD_DOCKERIMAGE="docker.io/prjemian/synapps-6.1-ad-3.7:latest" + +podman pull ${MOTOR_DOCKERIMAGE} +podman pull ${PE_DOCKERIMAGE} +podman pull ${AD_DOCKERIMAGE} + +podman pod stop ophyd_testing || true +podman pod rm ophyd_testing || true + +# create the testing pod, do not expose anything +podman pod create -n ophyd_testing + +# TODO do this with volumes +# set up directories for AD +mkdir -p /tmp/ophyd_AD_test/ +# Create YYYY/MM/DD subdirectories. +# This is required because the images use a version of AD which +# does not create missing directories. +python $SCRIPTS_DIR/create_directories.py /tmp/ophyd_AD_test/data1 + +podman run --pod ophyd_testing --name=sim_motor --rm -d ${MOTOR_DOCKERIMAGE} +podman run --pod ophyd_testing --name=area-detector --rm -dit -v /tmp/ophyd_AD_test:/tmp/ophyd_AD_test/ -e AD_PREFIX="ADSIM:" ${AD_DOCKERIMAGE} /bin/bash +sleep 1 # Probably not needed? +podman exec area-detector iocSimDetector/simDetector.sh start +podman run --pod ophyd_testing --name=pyepics-container --rm -d ${PE_DOCKERIMAGE} + +# make testing container +podman run --pod ophyd_testing --name test_target --rm -dit -v `pwd`:'/app' -w '/app' fedora bash +# make testing env +podman exec test_target python3 -m venv /test +podman exec test_target /test/bin/python -m pip install --upgrade pip +# install system deps +podman exec test_target yum install python3-devel gcc -y +# install python testing deps +podman exec test_target /test/bin/python -m pip install -r requirements-test.txt +# install (editable) ophyd +podman exec test_target /test/bin/python -m pip install -ve . diff --git a/scripts/test_in_pod.sh b/scripts/test_in_pod.sh new file mode 100755 index 000000000..1ae211e26 --- /dev/null +++ b/scripts/test_in_pod.sh @@ -0,0 +1,5 @@ +#! /usr/bin/bash +set -e +set -o xtrace + +podman exec -it test_target /test/bin/python -m pytest $@ From 827e1252c080f4a54832bd1f8751f1d00bd5872a Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Fri, 25 Feb 2022 15:05:41 -0500 Subject: [PATCH 2/2] MNT: add registry names to docker image names --- scripts/epics_docker.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/epics_docker.sh b/scripts/epics_docker.sh index aa96c12b8..c4cea0857 100755 --- a/scripts/epics_docker.sh +++ b/scripts/epics_docker.sh @@ -3,9 +3,9 @@ SCRIPTS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source $SCRIPTS_DIR/epics_exports.sh -MOTOR_DOCKERIMAGE="nsls2/epics-docker:latest" -PE_DOCKERIMAGE="nsls2/pyepics-docker:latest" -AD_DOCKERIMAGE="prjemian/synapps-6.1-ad-3.7:latest" +MOTOR_DOCKERIMAGE="docker.io/nsls2/epics-docker:latest" +PE_DOCKERIMAGE="docker.io/nsls2/pyepics-docker:latest" +AD_DOCKERIMAGE="docker.io/prjemian/synapps-6.1-ad-3.7:latest" docker pull ${MOTOR_DOCKERIMAGE} docker pull ${PE_DOCKERIMAGE}