|
@@ -5,6 +5,7 @@ from __future__ import unicode_literals
|
|
|
import datetime
|
|
|
import json
|
|
|
import os
|
|
|
+import os.path
|
|
|
import signal
|
|
|
import subprocess
|
|
|
import time
|
|
@@ -557,6 +558,39 @@ class CLITestCase(DockerClientTestCase):
|
|
|
|
|
|
self.assertEqual(old_ids, new_ids)
|
|
|
|
|
|
+ def test_run_one_off_with_volume(self):
|
|
|
+ self.base_dir = 'tests/fixtures/simple-composefile-volume-ready'
|
|
|
+ volume_path = os.path.abspath(os.path.join(os.getcwd(), self.base_dir, 'files'))
|
|
|
+ cmd_result = self.dispatch([
|
|
|
+ 'run',
|
|
|
+ '-v', '{}:/data'.format(volume_path),
|
|
|
+ 'simple',
|
|
|
+ 'cat', '/data/example.txt'
|
|
|
+ ])
|
|
|
+ assert cmd_result.stdout.strip() == 'FILE_CONTENT'
|
|
|
+
|
|
|
+ def test_run_one_off_with_multiple_volumes(self):
|
|
|
+ self.base_dir = 'tests/fixtures/simple-composefile-volume-ready'
|
|
|
+ volume_path = os.path.abspath(os.path.join(os.getcwd(), self.base_dir, 'files'))
|
|
|
+
|
|
|
+ cmd_result = self.dispatch([
|
|
|
+ 'run',
|
|
|
+ '-v', '{}:/data'.format(volume_path),
|
|
|
+ '-v', '{}:/data1'.format(volume_path),
|
|
|
+ 'simple',
|
|
|
+ 'cat', '/data/example.txt'
|
|
|
+ ])
|
|
|
+ assert cmd_result.stdout.strip() == 'FILE_CONTENT'
|
|
|
+
|
|
|
+ cmd_result = self.dispatch([
|
|
|
+ 'run',
|
|
|
+ '-v', '{}:/data'.format(volume_path),
|
|
|
+ '-v', '{}:/data1'.format(volume_path),
|
|
|
+ 'simple',
|
|
|
+ 'cat', '/data1/example.txt'
|
|
|
+ ])
|
|
|
+ assert cmd_result.stdout.strip() == 'FILE_CONTENT'
|
|
|
+
|
|
|
def test_create_with_force_recreate_and_no_recreate(self):
|
|
|
self.dispatch(
|
|
|
['create', '--force-recreate', '--no-recreate'],
|