@@ -1016,6 +1016,64 @@ def test_create_container_with_aliases(self):
1016
1016
}
1017
1017
}}''' ))
1018
1018
1019
+ @requires_api_version ('1.22' )
1020
+ def test_create_container_with_tmpfs_list (self ):
1021
+
1022
+ self .client .create_container (
1023
+ 'busybox' , 'true' , host_config = self .client .create_host_config (
1024
+ tmpfs = [
1025
+ "/tmp" ,
1026
+ "/mnt:size=3G,uid=100"
1027
+ ]
1028
+ )
1029
+ )
1030
+
1031
+ args = fake_request .call_args
1032
+ self .assertEqual (args [0 ][1 ], url_prefix +
1033
+ 'containers/create' )
1034
+ expected_payload = self .base_create_payload ()
1035
+ expected_payload ['HostConfig' ] = self .client .create_host_config ()
1036
+ expected_payload ['HostConfig' ]['Tmpfs' ] = {
1037
+ "/tmp" : "" ,
1038
+ "/mnt" : "size=3G,uid=100"
1039
+ }
1040
+ self .assertEqual (json .loads (args [1 ]['data' ]), expected_payload )
1041
+ self .assertEqual (args [1 ]['headers' ],
1042
+ {'Content-Type' : 'application/json' })
1043
+ self .assertEqual (
1044
+ args [1 ]['timeout' ],
1045
+ DEFAULT_TIMEOUT_SECONDS
1046
+ )
1047
+
1048
+ @requires_api_version ('1.22' )
1049
+ def test_create_container_with_tmpfs_dict (self ):
1050
+
1051
+ self .client .create_container (
1052
+ 'busybox' , 'true' , host_config = self .client .create_host_config (
1053
+ tmpfs = {
1054
+ "/tmp" : "" ,
1055
+ "/mnt" : "size=3G,uid=100"
1056
+ }
1057
+ )
1058
+ )
1059
+
1060
+ args = fake_request .call_args
1061
+ self .assertEqual (args [0 ][1 ], url_prefix +
1062
+ 'containers/create' )
1063
+ expected_payload = self .base_create_payload ()
1064
+ expected_payload ['HostConfig' ] = self .client .create_host_config ()
1065
+ expected_payload ['HostConfig' ]['Tmpfs' ] = {
1066
+ "/tmp" : "" ,
1067
+ "/mnt" : "size=3G,uid=100"
1068
+ }
1069
+ self .assertEqual (json .loads (args [1 ]['data' ]), expected_payload )
1070
+ self .assertEqual (args [1 ]['headers' ],
1071
+ {'Content-Type' : 'application/json' })
1072
+ self .assertEqual (
1073
+ args [1 ]['timeout' ],
1074
+ DEFAULT_TIMEOUT_SECONDS
1075
+ )
1076
+
1019
1077
1020
1078
class ContainerTest (DockerClientTest ):
1021
1079
def test_list_containers (self ):
0 commit comments