Add simple test for volume mounting

pull/172/head
yuvipanda 2017-12-19 11:16:10 -08:00
rodzic 0c0d921276
commit 6227cf14fe
1 zmienionych plików z 25 dodań i 0 usunięć

25
tests/volumes.py 100644
Wyświetl plik

@ -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