X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fcharm%2Fnbi%2Ftests%2Ftest_charm.py;fp=installers%2Fcharm%2Fnbi%2Ftests%2Ftest_charm.py;h=59a27fb735f4827ffddc8c5ccb85936b78c294ec;hb=4a46c6ee105522c9018e977977542e4bee50133c;hp=92c29808552d6d73d9333e5634c6e9a161d3cc13;hpb=0788ee16814242d83521669105378dd7ccaa6005;p=osm%2Fdevops.git diff --git a/installers/charm/nbi/tests/test_charm.py b/installers/charm/nbi/tests/test_charm.py index 92c29808..59a27fb7 100644 --- a/installers/charm/nbi/tests/test_charm.py +++ b/installers/charm/nbi/tests/test_charm.py @@ -155,6 +155,42 @@ class TestCharm(unittest.TestCase): # Verifying status self.assertIsInstance(self.harness.charm.unit.status, BlockedStatus) + def test_config_liveness_probe_with_relations( + self, + ) -> NoReturn: + "Test configuration of liveness probe with relations" + self.initialize_nbi_with_keystone() + self.config_liveness_probe() + # Verifying status + self.assertIsInstance(self.harness.charm.unit.status, ActiveStatus) + + def test_wrong_config_liveness_probe_with_relations( + self, + ) -> NoReturn: + "Test wrong configuration of liveness probe with relations" + self.initialize_nbi_with_keystone() + self.wrong_config_liveness_probe() + # Verifying status + self.assertIsInstance(self.harness.charm.unit.status, BlockedStatus) + + def test_config_readiness_probe_with_relations( + self, + ) -> NoReturn: + "Test configuration of readiness probe with relations" + self.initialize_nbi_with_keystone() + self.config_readiness_probe() + # Verifying status + self.assertIsInstance(self.harness.charm.unit.status, ActiveStatus) + + def test_wrong_config_readiness_probe_with_relations( + self, + ) -> NoReturn: + "Test wrong configuration of readiness probe with relations" + self.initialize_nbi_with_keystone() + self.wrong_config_readiness_probe() + # Verifying status + self.assertIsInstance(self.harness.charm.unit.status, BlockedStatus) + def initialize_kafka_relation(self): kafka_relation_id = self.harness.add_relation("kafka", "kafka") self.harness.add_relation_unit(kafka_relation_id, "kafka/0") @@ -165,6 +201,33 @@ class TestCharm(unittest.TestCase): def initialize_mongo_config(self): self.harness.update_config({"mongodb_uri": "mongodb://mongo:27017"}) + def initialize_nbi_with_keystone(self): + self.harness.update_config({"auth_backend": "keystone"}) + self.initialize_kafka_relation() + self.initialize_mongo_relation() + self.initialize_prometheus_relation() + self.initialize_keystone_relation() + + def config_liveness_probe(self): + self.harness.update_config( + {"tcpsocket_liveness_probe": '{"initial_delay_seconds": 10}'} + ) + + def wrong_config_liveness_probe(self): + self.harness.update_config( + {"tcpsocket_liveness_probe": "{initial_delay_seconds: 10}"} + ) + + def wrong_config_readiness_probe(self): + self.harness.update_config( + {"tcpsocket_readiness_probe": "{initial_delay_seconds: 10}"} + ) + + def config_readiness_probe(self): + self.harness.update_config( + {"tcpsocket_readiness_probe": '{"initial_delay_seconds": 10}'} + ) + def initialize_mongo_relation(self): mongodb_relation_id = self.harness.add_relation("mongodb", "mongodb") self.harness.add_relation_unit(mongodb_relation_id, "mongodb/0")