From: sousaedu Date: Mon, 18 Jan 2021 17:53:28 +0000 (+0000) Subject: Fixing kafka_port validation in RO charm X-Git-Tag: branch-sol006v331-start~76 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F10190%2F2;p=osm%2Fdevops.git Fixing kafka_port validation in RO charm Change-Id: I5d7ea4ecd3f45e901d0da431e386580f5c49611c Signed-off-by: sousaedu --- diff --git a/installers/charm/ro/src/pod_spec.py b/installers/charm/ro/src/pod_spec.py index b54710c6..6c91baff 100644 --- a/installers/charm/ro/src/pod_spec.py +++ b/installers/charm/ro/src/pod_spec.py @@ -65,7 +65,7 @@ def _validate_data( "kafka_host": lambda value, _: (isinstance(value, str) and len(value) > 0) if config_data.get("enable_ng_ro", True) else True, - "kafka_port": lambda value, _: (isinstance(value, int) and value > 0) + "kafka_port": lambda value, _: (isinstance(value, str) and len(value) > 0) if config_data.get("enable_ng_ro", True) else True, "mongodb_connection_string": lambda value, _: ( diff --git a/installers/charm/ro/tests/test_charm.py b/installers/charm/ro/tests/test_charm.py index cdc384f8..0aa9b7d4 100644 --- a/installers/charm/ro/tests/test_charm.py +++ b/installers/charm/ro/tests/test_charm.py @@ -91,7 +91,7 @@ class TestCharm(unittest.TestCase): "OSMRO_LOG_LEVEL": "INFO", "OSMRO_MESSAGE_DRIVER": "kafka", "OSMRO_MESSAGE_HOST": "kafka", - "OSMRO_MESSAGE_PORT": 9090, + "OSMRO_MESSAGE_PORT": "9090", "OSMRO_DATABASE_DRIVER": "mongo", "OSMRO_DATABASE_URI": "mongodb://mongo", "OSMRO_DATABASE_COMMONKEY": "osm", @@ -139,7 +139,7 @@ class TestCharm(unittest.TestCase): "kafka/0", { "host": "kafka", - "port": 9090, + "port": "9090", }, ) diff --git a/installers/charm/ro/tests/test_pod_spec.py b/installers/charm/ro/tests/test_pod_spec.py index 2dc11041..e6162420 100644 --- a/installers/charm/ro/tests/test_pod_spec.py +++ b/installers/charm/ro/tests/test_pod_spec.py @@ -54,7 +54,7 @@ class TestPodSpec(unittest.TestCase): } relation_state = { "kafka_host": "kafka", - "kafka_port": 9090, + "kafka_port": "9090", "mongodb_connection_string": "mongodb://mongo", } @@ -171,7 +171,7 @@ class TestPodSpec(unittest.TestCase): } relation_state = { "kafka_host": "kafka", - "kafka_port": 9090, + "kafka_port": "9090", "mongodb_connection_string": "mongodb://mongo", } app_name = "ro"