Allow integer value for ports
While it was intended as a positive to be stricter in validation it would in fact break backwards compatibility, which we do not want to be doing. Consider re-visiting this later and include a deprecation warning if we want to be stricter. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
This commit is contained in:
parent
df74b131ff
commit
b4872de213
3 changed files with 27 additions and 7 deletions
|
|
@ -75,8 +75,9 @@ class ConfigTest(unittest.TestCase):
|
|||
)
|
||||
|
||||
def test_config_invalid_ports_format_validation(self):
|
||||
with self.assertRaises(ConfigurationError):
|
||||
for invalid_ports in [{"1": "8000"}, "whatport", "625", "8000:8050"]:
|
||||
expected_error_msg = "Service 'web' configuration key 'ports' contains an invalid type"
|
||||
with self.assertRaisesRegexp(ConfigurationError, expected_error_msg):
|
||||
for invalid_ports in [{"1": "8000"}, False, 0]:
|
||||
config.load(
|
||||
config.ConfigDetails(
|
||||
{'web': {'image': 'busybox', 'ports': invalid_ports}},
|
||||
|
|
@ -86,7 +87,7 @@ class ConfigTest(unittest.TestCase):
|
|||
)
|
||||
|
||||
def test_config_valid_ports_format_validation(self):
|
||||
valid_ports = [["8000", "9000"], ["8000/8050"], ["8000"]]
|
||||
valid_ports = [["8000", "9000"], ["8000/8050"], ["8000"], "8000", 8000]
|
||||
for ports in valid_ports:
|
||||
config.load(
|
||||
config.ConfigDetails(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue