|
@@ -11,22 +11,24 @@ def _run(cmd):
|
11
|
11
|
|
12
|
12
|
|
13
|
13
|
@parameterized([
|
14
|
|
- 'docker run --name=test123 -d hello-world',
|
15
|
|
- 'docker run --name=test123 -d hello-world:latest',
|
16
|
|
- 'docker run --name=test123 -d hello-world /hello world...',
|
17
|
|
- 'docker run --name=test123 --restart=always -d hello-world',
|
18
|
|
- 'docker run --name=test123 --restart=on-failure:10 -d hello-world',
|
19
|
|
- 'docker run --name=test123 --net=host -d hello-world',
|
20
|
|
- 'docker run --name=test123 -d -p=127.0.0.1:443:443/tcp -p=127.0.0.1::1336/tcp hello-world',
|
21
|
|
- 'docker run --name=test123 -d -p=443/tcp hello-world',
|
22
|
|
- 'docker run --name=test123 --user=root -d hello-world /hello foobar',
|
23
|
|
- 'docker run --name=test123 --volume=/dev/null:/null --volume=/dev/urandom:/mnt/random -d hello-world',
|
|
14
|
+ ['docker', 'run', '--name=test123', '-d', 'hello-world'],
|
|
15
|
+ ['docker', 'run', '--name=test123', '-d', 'hello-world:latest'],
|
|
16
|
+ ['docker', 'run', '--name=test123', '-d', 'hello-world', '/hello', 'world...'],
|
|
17
|
+ ['docker', 'run', '--env=PATH=/root', '--env=Z=X', '--name=test123', '-d', 'hello-world'],
|
|
18
|
+ ['docker', 'run', '--env=FOO=bar baz', '--name=test1234', '-d', 'hello-world'],
|
|
19
|
+ ['docker', 'run', '--name=test123', '--restart=always', '-d', 'hello-world'],
|
|
20
|
+ ['docker', 'run', '--name=test123', '--restart=on-failure:10', '-d', 'hello-world'],
|
|
21
|
+ ['docker', 'run', '--name=test123', '--net=host', '-d', 'hello-world'],
|
|
22
|
+ ['docker', 'run', '--name=test123', '-d', '-p=127.0.0.1:443:443/tcp', '-p=127.0.0.1::1336/tcp', 'hello-world'],
|
|
23
|
+ ['docker', 'run', '--name=test123', '-d', '-p=443/tcp', 'hello-world'],
|
|
24
|
+ ['docker', 'run', '--name=test123', '--user=root', '-d', 'hello-world', '/hello', 'foobar'],
|
|
25
|
+ ['docker', 'run', '--name=test123', '--volume=/dev/null:/null', '--volume=/dev/urandom:/mnt/random', '-d', 'hello-world'],
|
24
|
26
|
])
|
25
|
|
-def test_command_matches(command):
|
|
27
|
+def test_command_matches(*command):
|
26
|
28
|
_run(['docker', 'rm', '-f', 'test123'])
|
27
|
|
- _run(command.split(' '))
|
|
29
|
+ _run(command)
|
28
|
30
|
output = subprocess.check_output(['./docker-rerun', '--dry-run', 'test123'])
|
29
|
31
|
output = output.decode('utf-8').strip().splitlines()
|
30
|
|
- assert output[3] == command
|
|
32
|
+ assert output[3] == ' '.join(command)
|
31
|
33
|
_run(['docker', 'rm', '-f', 'test123'])
|
32
|
34
|
|