X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;ds=inline;f=installers%2Fcharm%2Fnbi%2Ftests%2Ftest_charm.py;h=657e89bd37dc814ce8355da688d80010ca01add4;hb=426d4938f27b200f359078258f41109b399d5e06;hp=d1d241352eb58dc35c052eab88d75cd536977d2e;hpb=6248fe6005403005832d6e770e83322d5f679e0f;p=osm%2Fdevops.git diff --git a/installers/charm/nbi/tests/test_charm.py b/installers/charm/nbi/tests/test_charm.py index d1d24135..657e89bd 100644 --- a/installers/charm/nbi/tests/test_charm.py +++ b/installers/charm/nbi/tests/test_charm.py @@ -100,12 +100,12 @@ class TestCharm(unittest.TestCase): "OSMNBI_MESSAGE_DRIVER": "kafka", "OSMNBI_MESSAGE_PORT": 9092, "OSMNBI_DATABASE_DRIVER": "mongo", - "OSMNBI_DATABASE_URI": "mongo://mongo:27017", + "OSMNBI_DATABASE_URI": "mongodb://mongo:27017", "OSMNBI_DATABASE_COMMONKEY": "osm", "OSMNBI_STORAGE_DRIVER": "mongo", "OSMNBI_STORAGE_PATH": "/app/storage", "OSMNBI_STORAGE_COLLECTION": "files", - "OSMNBI_STORAGE_URI": "mongo://mongo:27017", + "OSMNBI_STORAGE_URI": "mongodb://mongo:27017", "OSMNBI_PROMETHEUS_HOST": "prometheus", "OSMNBI_PROMETHEUS_PORT": 9090, "OSMNBI_LOG_LEVEL": "INFO", @@ -144,7 +144,7 @@ class TestCharm(unittest.TestCase): self.harness.update_relation_data( mongodb_relation_id, "mongodb/0", - {"connection_string": "mongo://mongo:27017"}, + {"connection_string": "mongodb://mongo:27017"}, ) # Initializing the prometheus relation @@ -161,7 +161,7 @@ class TestCharm(unittest.TestCase): self.assertEqual(self.harness.charm.state.message_port, 9092) # Checking if mongodb data is stored - self.assertEqual(self.harness.charm.state.database_uri, "mongo://mongo:27017") + self.assertEqual(self.harness.charm.state.database_uri, "mongodb://mongo:27017") # Checking if prometheus data is stored self.assertEqual(self.harness.charm.state.prometheus_host, "prometheus") @@ -198,12 +198,12 @@ class TestCharm(unittest.TestCase): "OSMNBI_MESSAGE_DRIVER": "kafka", "OSMNBI_MESSAGE_PORT": 9092, "OSMNBI_DATABASE_DRIVER": "mongo", - "OSMNBI_DATABASE_URI": "mongo://mongo:27017", + "OSMNBI_DATABASE_URI": "mongodb://mongo:27017", "OSMNBI_DATABASE_COMMONKEY": "osm", "OSMNBI_STORAGE_DRIVER": "mongo", "OSMNBI_STORAGE_PATH": "/app/storage", "OSMNBI_STORAGE_COLLECTION": "files", - "OSMNBI_STORAGE_URI": "mongo://mongo:27017", + "OSMNBI_STORAGE_URI": "mongodb://mongo:27017", "OSMNBI_PROMETHEUS_HOST": "prometheus", "OSMNBI_PROMETHEUS_PORT": 9090, "OSMNBI_LOG_LEVEL": "INFO", @@ -260,7 +260,7 @@ class TestCharm(unittest.TestCase): self.harness.update_relation_data( mongodb_relation_id, "mongodb/0", - {"connection_string": "mongo://mongo:27017"}, + {"connection_string": "mongodb://mongo:27017"}, ) # Initializing the prometheus relation @@ -294,7 +294,7 @@ class TestCharm(unittest.TestCase): self.assertEqual(self.harness.charm.state.message_port, 9092) # Checking if mongodb data is stored - self.assertEqual(self.harness.charm.state.database_uri, "mongo://mongo:27017") + self.assertEqual(self.harness.charm.state.database_uri, "mongodb://mongo:27017") # Checking if prometheus data is stored self.assertEqual(self.harness.charm.state.prometheus_host, "prometheus") @@ -342,12 +342,12 @@ class TestCharm(unittest.TestCase): "OSMNBI_MESSAGE_DRIVER": "kafka", "OSMNBI_MESSAGE_PORT": 9092, "OSMNBI_DATABASE_DRIVER": "mongo", - "OSMNBI_DATABASE_URI": "mongo://mongo:27017", + "OSMNBI_DATABASE_URI": "mongodb://mongo:27017", "OSMNBI_DATABASE_COMMONKEY": "osm", "OSMNBI_STORAGE_DRIVER": "mongo", "OSMNBI_STORAGE_PATH": "/app/storage", "OSMNBI_STORAGE_COLLECTION": "files", - "OSMNBI_STORAGE_URI": "mongo://mongo:27017", + "OSMNBI_STORAGE_URI": "mongodb://mongo:27017", "OSMNBI_PROMETHEUS_HOST": "prometheus", "OSMNBI_PROMETHEUS_PORT": 9090, "OSMNBI_LOG_LEVEL": "INFO", @@ -375,7 +375,7 @@ class TestCharm(unittest.TestCase): self.harness.update_relation_data( mongodb_relation_id, "mongodb/0", - {"connection_string": "mongo://mongo:27017"}, + {"connection_string": "mongodb://mongo:27017"}, ) # Initializing the prometheus relation @@ -417,12 +417,12 @@ class TestCharm(unittest.TestCase): "OSMNBI_MESSAGE_DRIVER": "kafka", "OSMNBI_MESSAGE_PORT": 9092, "OSMNBI_DATABASE_DRIVER": "mongo", - "OSMNBI_DATABASE_URI": "mongo://mongo:27017", + "OSMNBI_DATABASE_URI": "mongodb://mongo:27017", "OSMNBI_DATABASE_COMMONKEY": "osm", "OSMNBI_STORAGE_DRIVER": "mongo", "OSMNBI_STORAGE_PATH": "/app/storage", "OSMNBI_STORAGE_COLLECTION": "files", - "OSMNBI_STORAGE_URI": "mongo://mongo:27017", + "OSMNBI_STORAGE_URI": "mongodb://mongo:27017", "OSMNBI_PROMETHEUS_HOST": "prometheus", "OSMNBI_PROMETHEUS_PORT": 9090, "OSMNBI_LOG_LEVEL": "INFO", @@ -437,6 +437,7 @@ class TestCharm(unittest.TestCase): "annotations": { "nginx.ingress.kubernetes.io/proxy-body-size": "0", "nginx.ingress.kubernetes.io/ssl-redirect": "false", + "nginx.ingress.kubernetes.io/backend-protocol": "HTTPS", }, "spec": { "rules": [ @@ -476,7 +477,7 @@ class TestCharm(unittest.TestCase): self.harness.update_relation_data( mongodb_relation_id, "mongodb/0", - {"connection_string": "mongo://mongo:27017"}, + {"connection_string": "mongodb://mongo:27017"}, ) # Initializing the prometheus relation @@ -518,12 +519,12 @@ class TestCharm(unittest.TestCase): "OSMNBI_MESSAGE_DRIVER": "kafka", "OSMNBI_MESSAGE_PORT": 9092, "OSMNBI_DATABASE_DRIVER": "mongo", - "OSMNBI_DATABASE_URI": "mongo://mongo:27017", + "OSMNBI_DATABASE_URI": "mongodb://mongo:27017", "OSMNBI_DATABASE_COMMONKEY": "osm", "OSMNBI_STORAGE_DRIVER": "mongo", "OSMNBI_STORAGE_PATH": "/app/storage", "OSMNBI_STORAGE_COLLECTION": "files", - "OSMNBI_STORAGE_URI": "mongo://mongo:27017", + "OSMNBI_STORAGE_URI": "mongodb://mongo:27017", "OSMNBI_PROMETHEUS_HOST": "prometheus", "OSMNBI_PROMETHEUS_PORT": 9090, "OSMNBI_LOG_LEVEL": "INFO", @@ -537,6 +538,7 @@ class TestCharm(unittest.TestCase): "name": "nbi-ingress", "annotations": { "nginx.ingress.kubernetes.io/proxy-body-size": "0", + "nginx.ingress.kubernetes.io/backend-protocol": "HTTPS", }, "spec": { "rules": [ @@ -577,7 +579,7 @@ class TestCharm(unittest.TestCase): self.harness.update_relation_data( mongodb_relation_id, "mongodb/0", - {"connection_string": "mongo://mongo:27017"}, + {"connection_string": "mongodb://mongo:27017"}, ) # Initializing the prometheus relation @@ -621,12 +623,12 @@ class TestCharm(unittest.TestCase): "OSMNBI_MESSAGE_DRIVER": "kafka", "OSMNBI_MESSAGE_PORT": 9092, "OSMNBI_DATABASE_DRIVER": "mongo", - "OSMNBI_DATABASE_URI": "mongo://mongo:27017", + "OSMNBI_DATABASE_URI": "mongodb://mongo:27017", "OSMNBI_DATABASE_COMMONKEY": "osm", "OSMNBI_STORAGE_DRIVER": "mongo", "OSMNBI_STORAGE_PATH": "/app/storage", "OSMNBI_STORAGE_COLLECTION": "files", - "OSMNBI_STORAGE_URI": "mongo://mongo:27017", + "OSMNBI_STORAGE_URI": "mongodb://mongo:27017", "OSMNBI_PROMETHEUS_HOST": "prometheus", "OSMNBI_PROMETHEUS_PORT": 9090, "OSMNBI_LOG_LEVEL": "INFO", @@ -640,6 +642,7 @@ class TestCharm(unittest.TestCase): "name": "nbi-ingress", "annotations": { "nginx.ingress.kubernetes.io/proxy-body-size": "0", + "nginx.ingress.kubernetes.io/backend-protocol": "HTTPS", "nginx.ingress.kubernetes.io/whitelist-source-range": "0.0.0.0/0", }, "spec": { @@ -681,7 +684,7 @@ class TestCharm(unittest.TestCase): self.harness.update_relation_data( mongodb_relation_id, "mongodb/0", - {"connection_string": "mongo://mongo:27017"}, + {"connection_string": "mongodb://mongo:27017"}, ) # Initializing the prometheus relation @@ -705,7 +708,7 @@ class TestCharm(unittest.TestCase): self.assertDictEqual(expected_result, pod_spec) - def test_on_kafka_relation_changed(self) -> NoReturn: + def test_on_kafka_unit_relation_changed(self) -> NoReturn: """Test to see if kafka relation is updated.""" self.harness.charm.on.start.emit() @@ -735,7 +738,7 @@ class TestCharm(unittest.TestCase): self.assertNotIn("keystone", self.harness.charm.unit.status.message) self.assertTrue(self.harness.charm.unit.status.message.endswith(" relations")) - def test_on_mongodb_relation_changed(self) -> NoReturn: + def test_on_mongodb_unit_relation_changed(self) -> NoReturn: """Test to see if mongodb relation is updated.""" self.harness.charm.on.start.emit() @@ -744,10 +747,10 @@ class TestCharm(unittest.TestCase): relation_id = self.harness.add_relation("mongodb", "mongodb") self.harness.add_relation_unit(relation_id, "mongodb/0") self.harness.update_relation_data( - relation_id, "mongodb/0", {"connection_string": "mongo://mongo:27017"} + relation_id, "mongodb/0", {"connection_string": "mongodb://mongo:27017"} ) - self.assertEqual(self.harness.charm.state.database_uri, "mongo://mongo:27017") + self.assertEqual(self.harness.charm.state.database_uri, "mongodb://mongo:27017") # Verifying status self.assertIsInstance(self.harness.charm.unit.status, BlockedStatus) @@ -763,7 +766,7 @@ class TestCharm(unittest.TestCase): self.assertNotIn("keystone", self.harness.charm.unit.status.message) self.assertTrue(self.harness.charm.unit.status.message.endswith(" relations")) - def test_on_prometheus_relation_changed(self) -> NoReturn: + def test_on_prometheus_unit_relation_changed(self) -> NoReturn: """Test to see if prometheus relation is updated.""" self.harness.charm.on.start.emit() @@ -793,7 +796,7 @@ class TestCharm(unittest.TestCase): self.assertNotIn("keystone", self.harness.charm.unit.status.message) self.assertTrue(self.harness.charm.unit.status.message.endswith(" relations")) - def test_on_keystone_relation_changed(self) -> NoReturn: + def test_on_keystone_unit_relation_changed(self) -> NoReturn: """Test to see if keystone relation is updated.""" self.harness.update_config({"auth_backend": "keystone"}) @@ -858,7 +861,7 @@ class TestCharm(unittest.TestCase): relation_id = self.harness.add_relation("nbi", "ng-ui") self.harness.add_relation_unit(relation_id, "ng-ui/0") - relation_data = self.harness.get_relation_data(relation_id, "nbi") + relation_data = self.harness.get_relation_data(relation_id, "nbi/0") self.assertDictEqual(expected_result, relation_data)