Commit f4bb5cda authored by Samuel GAIST's avatar Samuel GAIST

[test][docker] Add test for workdir property

parent 79915517
......@@ -39,7 +39,10 @@ import time
import requests
import nose
from tempfile import TemporaryDirectory
from ..dock import Host
from . import tmp_prefix
from .utils import slow
from .utils import skipif
......@@ -136,6 +139,31 @@ class EnvironmentVariableTest(NoDiscoveryTests):
self.assertTrue('DOCKER_TEST=good' in self.host.logs(container))
class WorkdirTest(NoDiscoveryTests):
@slow
def test_workdir(self):
"""Test that the workdir property is correctly used.
"""
with TemporaryDirectory() as tmp_folder:
test_file = "test.txt"
container = self.host.create_container('debian:8.4', ["cp", "/etc/debian_version", test_file])
container.add_volume(tmp_folder, '/test_workdir', read_only=False)
container.set_workdir('/test_workdir')
self.host.start(container)
status = self.host.wait(container)
if status != 0:
print(self.host.logs(container))
self.assertEqual(status, 0)
with open(os.path.join(tmp_folder, test_file), "rt") as file:
content = file.read()
self.assertEqual(content, "8.4\n")
class AsyncTest(NoDiscoveryTests):
@slow
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment