Ver Fonte

Allow entrypoint to be a list or string

Signed-off-by: Mazz Mosley <[email protected]>
Mazz Mosley há 10 anos atrás
pai
commit
866979c57b
2 ficheiros alterados com 16 adições e 1 exclusões
  1. 1 1
      compose/config/fields_schema.json
  2. 15 0
      tests/unit/config_test.py

+ 1 - 1
compose/config/fields_schema.json

@@ -32,7 +32,7 @@
         "dns_search": {"$ref": "#/definitions/string_or_list"},
         "dockerfile": {"type": "string"},
         "domainname": {"type": "string"},
-        "entrypoint": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
+        "entrypoint": {"$ref": "#/definitions/string_or_list"},
         "env_file": {"$ref": "#/definitions/string_or_list"},
 
         "environment": {

+ 15 - 0
tests/unit/config_test.py

@@ -254,6 +254,21 @@ class ConfigTest(unittest.TestCase):
             )
             self.assertEqual(service[0]['expose'], expose)
 
+    def test_valid_config_oneof_string_or_list(self):
+        entrypoint_values = [["sh"], "sh"]
+        for entrypoint in entrypoint_values:
+            service = config.load(
+                config.ConfigDetails(
+                    {'web': {
+                        'image': 'busybox',
+                        'entrypoint': entrypoint
+                    }},
+                    'working_dir',
+                    'filename.yml'
+                )
+            )
+            self.assertEqual(service[0]['entrypoint'], entrypoint)
+
 
 class InterpolationTest(unittest.TestCase):
     @mock.patch.dict(os.environ)