From 6227cf14fef5312595be96eadc74eb75f7d2c8fb Mon Sep 17 00:00:00 2001 From: yuvipanda Date: Tue, 19 Dec 2017 11:16:10 -0800 Subject: [PATCH] Add simple test for volume mounting --- tests/volumes.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/volumes.py diff --git a/tests/volumes.py b/tests/volumes.py new file mode 100644 index 00000000..5ce38c2c --- /dev/null +++ b/tests/volumes.py @@ -0,0 +1,25 @@ +""" +Test that volume mounts work when running +""" +import os +import subprocess +import tempfile +import time + +def test_volume_home(): + """ + Validate that you can bind mount a volume onto homedirectory & write to it + """ + ts = str(time.time()) + with tempfile.TemporaryDirectory() as tmpdir: + subprocess.check_call([ + 'repo2docker', + '-v', '{}:/home/jovyan'.format(tmpdir), + tmpdir, + '--', + '/bin/bash', + '-c', 'echo -n {} > ts'.format(ts) + ]) + + with open(os.path.join(tmpdir, 'ts')) as f: + assert f.read() == ts