4444 echo "2.4.0"
4545else
4646 echo "singularity was called with arguments: $@"
47+ # actually create image file using 'touch'
48+ echo "$@"
49+ echo $#
50+ if [[ $# -eq 3 ]]; then
51+ img=$2
52+ elif [[ $# -eq 4 ]]; then
53+ img=$3
54+ else
55+ echo "Don't know how to extract container image location" >&2
56+ exit 1
57+ fi
58+ touch $img
4759fi
4860"""
4961
@@ -222,6 +234,8 @@ def test_end2end_singularity_image(self):
222234 ]
223235 self .check_regexs (regexs , stdout )
224236
237+ self .assertTrue (os .path .exists (os .path .join (containerpath , 'toy-0.0.simg' )))
238+
225239 remove_file (os .path .join (containerpath , 'Singularity.toy-0.0' ))
226240
227241 # check use of --container-image-format & --container-image-name
@@ -236,11 +250,12 @@ def test_end2end_singularity_image(self):
236250 regexs [- 1 ] = "^== Singularity image created at %s/containers/foo-bar\.img$" % self .test_prefix
237251 self .check_regexs (regexs , stdout )
238252
253+ cont_img = os .path .join (containerpath , 'foo-bar.img' )
254+ self .assertTrue (os .path .exists (cont_img ))
255+
239256 remove_file (os .path .join (containerpath , 'Singularity.foo-bar' ))
240257
241258 # test again with container image already existing
242- cont_img = os .path .join (containerpath , 'foo-bar.img' )
243- write_file (cont_img , '' )
244259
245260 error_pattern = "Container image already exists at %s, not overwriting it without --force" % cont_img
246261 self .mock_stdout (True )
@@ -254,6 +269,13 @@ def test_end2end_singularity_image(self):
254269 "WARNING: overwriting existing container image at %s due to --force" % cont_img ,
255270 ])
256271 self .check_regexs (regexs , stdout )
272+ self .assertTrue (os .path .exists (cont_img ))
273+
274+ # also check behaviour under --extended-dry-run
275+ args .append ('--extended-dry-run' )
276+ stdout , stderr = self .run_main (args )
277+ self .assertFalse (stderr )
278+ self .check_regexs (regexs , stdout )
257279
258280
259281def suite ():
0 commit comments