Skip to content

Commit ce3a69c

Browse files
committed
more tests
1 parent 53daa58 commit ce3a69c

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/more_tests.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ echo "pyyaml" > req.txt
1111
echo "pip install requests" > post.sh
1212

1313
default_container=$(cat $SCRIPT_DIR/../default_config/config.yaml | grep container_src | cut -d ":" -f2- | sed "s/'//g" )
14-
singularity pull test_container.sif $default_container
14+
if [[ "$default_container"=="auto" ]];then
15+
default_container=$(python3 ../get_container.py)
16+
fi
17+
set -e
18+
t_run "singularity pull test_container.sif docker://$default_container" "default or auto determined container exists and can be downloaded"
19+
set +e
1520

1621
cat ../../default_config/config.yaml | sed "s@container_src.*\$@container_src: $PWD/test_container.sif@g" > my_config.yaml | sed 's/container_image.*$/container_image: container.sif/g'
1722
if grep -q share_container my_config.yaml ; then
@@ -69,6 +74,18 @@ rm -fr PIP_INSTALL_DIR
6974
mkdir PIP_INSTALL_DIR
7075
t_run "wrap-container -w /usr/sbin/zdump --prefix PIP_INSTALL_DIR test_container.sif" "wrap-container works with single target"
7176

77+
rm -fr WRAP_TEST
78+
mkdir WRAP_TEST
79+
t_run "wrap-container docker://python:3.12.9-slim-bookworm -w /usr/local/bin --prefix WRAP_TEST/WW" "Wrap container for remote container"
80+
t_run "WRAP_TEST/WW/bin/python --version | grep '3.12.9'" "Wrapped container actually contains the correct version of python"
81+
t_run "WRAP_TEST/WW/bin/python -m venv WRAP_TEST/Py" "Creating a virtual environment on wrapped python works"
82+
t_run "WRAP_TEST/Py/bin/python -c 'import sys;sys.exit( sys.prefix == sys.base_prefix )'" "Created venv is functional"
83+
t_run "WRAP_TEST/Py/bin/python -c 'import shutil; print(shutil.which(\"python\"))' | grep 'WRAP_TEST/Py'" "Trick to retain venv path works"
84+
source WRAP_TEST/Py/bin/activate
85+
t_run "python -c 'import sys;sys.exit( sys.prefix == sys.base_prefix )'" "Created venv is functional (activated env)"
86+
t_run "python -c 'import shutil; print(shutil.which(\"python\"))' | grep 'WRAP_TEST/Py'" "Trick to retain venv path works (activated env)"
87+
deactivate
88+
7289
rm -fr PIP_INSTALL_DIR
7390
mkdir PIP_INSTALL_DIR
7491
t_run "wrap-container -w /usr/sbin --prefix PIP_INSTALL_DIR test_container.sif" "wrap-container works"

0 commit comments

Comments
 (0)