File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -215,6 +215,20 @@ def test_create_with_mac_address(self):
215
215
216
216
self .client .kill (id )
217
217
218
+ @requires_api_version ('1.41' )
219
+ def test_create_with_cgroupns (self ):
220
+ host_config = self .client .create_host_config (cgroupns = 'private' )
221
+
222
+ container = self .client .create_container (
223
+ image = TEST_IMG ,
224
+ command = ['sleep' , '60' ],
225
+ host_config = host_config ,
226
+ )
227
+ self .tmp_containers .append (container )
228
+
229
+ res = self .client .inspect_container (container )
230
+ assert 'private' == res ['HostConfig' ]['CgroupnsMode' ]
231
+
218
232
def test_group_id_ints (self ):
219
233
container = self .client .create_container (
220
234
TEST_IMG , 'id -G' ,
Original file line number Diff line number Diff line change @@ -1069,6 +1069,25 @@ def test_create_container_with_host_config_cpus(self):
1069
1069
''' )
1070
1070
assert args [1 ]['headers' ] == {'Content-Type' : 'application/json' }
1071
1071
1072
+ @requires_api_version ('1.41' )
1073
+ def test_create_container_with_cgroupns (self ):
1074
+ self .client .create_container (
1075
+ image = 'busybox' ,
1076
+ command = 'true' ,
1077
+ host_config = self .client .create_host_config (
1078
+ cgroupns = 'private' ,
1079
+ ),
1080
+ )
1081
+
1082
+ args = fake_request .call_args
1083
+ assert args [0 ][1 ] == url_prefix + 'containers/create'
1084
+
1085
+ expected_payload = self .base_create_payload ()
1086
+ expected_payload ['HostConfig' ] = self .client .create_host_config ()
1087
+ expected_payload ['HostConfig' ]['CgroupnsMode' ] = 'private'
1088
+ assert json .loads (args [1 ]['data' ]) == expected_payload
1089
+ assert args [1 ]['headers' ] == {'Content-Type' : 'application/json' }
1090
+
1072
1091
1073
1092
class ContainerTest (BaseAPIClientTest ):
1074
1093
def test_list_containers (self ):
You can’t perform that action at this time.
0 commit comments