@@ -33,6 +33,13 @@ def get_volume_mapping(volume_mapping):
33
33
return volume_mapping
34
34
35
35
36
+ def get_docker_config_volume ():
37
+ suffix = runner .get_docker_config_volume_suffix ()
38
+ return get_volume_mapping (
39
+ f'{ HOME_DIR } { suffix } :{ DOCKER_CONFIG } { suffix } :rw'
40
+ )
41
+
42
+
36
43
@mock .patch ('skipper.runner._network_exists' , mock .MagicMock (autospec = True , return_value = True ))
37
44
class TestRunner (unittest .TestCase ):
38
45
@@ -96,8 +103,7 @@ def test_run_simple_command_nested_network_exist(self, resource_filename_mock, c
96
103
'-e' , 'SKIPPER_DOCKER_GID=978' ,
97
104
'-v' , get_volume_mapping ('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict (homedir = HOME_DIR )),
98
105
'-v' , get_volume_mapping ('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict (homedir = HOME_DIR )),
99
- '-v' , get_volume_mapping ('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict (
100
- homedir = HOME_DIR , docker_config = DOCKER_CONFIG )),
106
+ '-v' , get_docker_config_volume (),
101
107
'-v' , get_volume_mapping ('/etc/docker:/etc/docker:ro' ),
102
108
'-v' , get_volume_mapping ('%(workdir)s:%(workdir)s:rw' % dict (workdir = WORKDIR )),
103
109
'-v' , get_volume_mapping ('/var/run/docker.sock:/var/run/docker.sock:rw' ),
@@ -145,8 +151,7 @@ def test_run_simple_command_nested_network_not_exist(self, resource_filename_moc
145
151
'-e' , 'SKIPPER_DOCKER_GID=978' ,
146
152
'-v' , get_volume_mapping ('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict (homedir = HOME_DIR )),
147
153
'-v' , get_volume_mapping ('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict (homedir = HOME_DIR )),
148
- '-v' , get_volume_mapping ('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict (
149
- homedir = HOME_DIR , docker_config = DOCKER_CONFIG )),
154
+ '-v' , get_docker_config_volume (),
150
155
'-v' , get_volume_mapping ('/etc/docker:/etc/docker:ro' ),
151
156
'-v' , get_volume_mapping ('%(workdir)s:%(workdir)s:rw' % dict (workdir = WORKDIR )),
152
157
'-v' , get_volume_mapping ('/var/run/docker.sock:/var/run/docker.sock:rw' ),
@@ -195,8 +200,7 @@ def test_run_simple_command_nested_with_env(self, resource_filename_mock, check_
195
200
'-e' , 'SKIPPER_DOCKER_GID=978' ,
196
201
'-v' , get_volume_mapping ('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict (homedir = HOME_DIR )),
197
202
'-v' , get_volume_mapping ('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict (homedir = HOME_DIR )),
198
- '-v' , get_volume_mapping ('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict (
199
- homedir = HOME_DIR , docker_config = DOCKER_CONFIG )),
203
+ '-v' , get_docker_config_volume (),
200
204
'-v' , get_volume_mapping ('/etc/docker:/etc/docker:ro' ),
201
205
'-v' , get_volume_mapping ('%(workdir)s:%(workdir)s:rw' % dict (workdir = WORKDIR )),
202
206
'-v' , get_volume_mapping ('/var/run/docker.sock:/var/run/docker.sock:rw' ),
@@ -254,8 +258,7 @@ def test_run_simple_command_nested_with_env_file(
254
258
homedir = HOME_DIR )),
255
259
'-v' , get_volume_mapping ('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict (
256
260
homedir = HOME_DIR )),
257
- '-v' , get_volume_mapping ('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict (
258
- homedir = HOME_DIR , docker_config = DOCKER_CONFIG )),
261
+ '-v' , get_docker_config_volume (),
259
262
'-v' , get_volume_mapping ('/etc/docker:/etc/docker:ro' ),
260
263
'-v' , get_volume_mapping ('%(workdir)s:%(workdir)s:rw' % dict (workdir = WORKDIR )),
261
264
'-v' , get_volume_mapping ('/var/run/docker.sock:/var/run/docker.sock:rw' ),
@@ -314,8 +317,7 @@ def test_run_simple_command_nested_with_multiple_env_files(
314
317
homedir = HOME_DIR ),
315
318
'-v' , '%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict (
316
319
homedir = HOME_DIR ),
317
- '-v' , get_volume_mapping ('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict (
318
- homedir = HOME_DIR , docker_config = DOCKER_CONFIG )),
320
+ '-v' , get_docker_config_volume (),
319
321
'-v' , '/etc/docker:/etc/docker:ro' ,
320
322
'-v' , '%(workdir)s:%(workdir)s:rw' % dict (workdir = WORKDIR ),
321
323
'-v' , '/var/run/docker.sock:/var/run/docker.sock:rw' ,
@@ -366,8 +368,7 @@ def test_run_simple_command_nested_interactive(self, resource_filename_mock,
366
368
'-e' , 'SKIPPER_DOCKER_GID=978' ,
367
369
'-v' , get_volume_mapping ('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict (homedir = HOME_DIR )),
368
370
'-v' , get_volume_mapping ('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict (homedir = HOME_DIR )),
369
- '-v' , get_volume_mapping ('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict (
370
- homedir = HOME_DIR , docker_config = DOCKER_CONFIG )),
371
+ '-v' , get_docker_config_volume (),
371
372
'-v' , get_volume_mapping ('/etc/docker:/etc/docker:ro' ),
372
373
'-v' , get_volume_mapping ('%(workdir)s:%(workdir)s:rw' % dict (workdir = WORKDIR )),
373
374
'-v' , get_volume_mapping ('/var/run/docker.sock:/var/run/docker.sock:rw' ),
@@ -414,8 +415,7 @@ def test_run_complex_command_nested(self, resource_filename_mock, check_output_m
414
415
'-e' , 'SKIPPER_DOCKER_GID=978' ,
415
416
'-v' , get_volume_mapping ('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict (homedir = HOME_DIR )),
416
417
'-v' , get_volume_mapping ('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict (homedir = HOME_DIR )),
417
- '-v' , get_volume_mapping ('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict (
418
- homedir = HOME_DIR , docker_config = DOCKER_CONFIG )),
418
+ '-v' , get_docker_config_volume (),
419
419
'-v' , get_volume_mapping ('/etc/docker:/etc/docker:ro' ),
420
420
'-v' , get_volume_mapping ('%(workdir)s:%(workdir)s:rw' % dict (workdir = WORKDIR )),
421
421
'-v' , get_volume_mapping ('/var/run/docker.sock:/var/run/docker.sock:rw' ),
@@ -466,8 +466,7 @@ def test_run_complex_command_nested_with_env(self, resource_filename_mock, check
466
466
'-e' , 'SKIPPER_DOCKER_GID=978' ,
467
467
'-v' , get_volume_mapping ('%(homedir)s/.netrc:%(homedir)s/.netrc:ro' % dict (homedir = HOME_DIR )),
468
468
'-v' , get_volume_mapping ('%(homedir)s/.gitconfig:%(homedir)s/.gitconfig:ro' % dict (homedir = HOME_DIR )),
469
- '-v' , get_volume_mapping ('%(homedir)s/.docker/config.json:%(docker_config)s/config.json:rw' % dict (
470
- homedir = HOME_DIR , docker_config = DOCKER_CONFIG )),
469
+ '-v' , get_docker_config_volume (),
471
470
'-v' , get_volume_mapping ('/etc/docker:/etc/docker:ro' ),
472
471
'-v' , get_volume_mapping ('%(workdir)s:%(workdir)s:rw' % dict (workdir = WORKDIR )),
473
472
'-v' , get_volume_mapping ('/var/run/docker.sock:/var/run/docker.sock:rw' ),
0 commit comments