Change-Id: I606a36a373c39d7d15e572d90065acd093506de5
Signed-off-by: sousaedu <eduardo.sousa@canonical.com>
Returns:
Dict[str, Any]: pod environment configuration.
"""
+ parsed = urlparse(relation_state.get("mongodb_connection_string"))
+
envconfig = {
- "MONGODB_URI": relation_state.get("mongodb_connection_string"),
+ "MONGODB_URI": f"mongodb://{parsed.netloc.split(',')[0]}{parsed.path}",
}
+ if parsed.query:
+ envconfig["MONGODB_URI"] += f"?{parsed.query}"
+
return envconfig
self.harness = Harness(MongodbExporterCharm)
self.harness.set_leader(is_leader=True)
self.harness.begin()
- self.harness.update_config(self.config)
def test_on_start_without_relations(self) -> NoReturn:
"""Test installation without any relation."""