From aa729eb46c80980808ece5b5bbcd2a600e3f3fa7 Mon Sep 17 00:00:00 2001 From: Math Marchand Date: Fri, 22 Nov 2024 03:44:54 -0500 Subject: [PATCH 1/3] fix: Adding test_invalid_databag_content for ClusterProvider (#102) * fix: Adding test_invalid_databag_content for ClusterProvider Signed-off-by: Mathieu Marchand * fix: Improving test_invalid_databag_content for ClusterProvider. Signed-off-by: Mathieu Marchand * fix: Improving test_invalid_databag - Used directly the Coordinator ClusterProvider object. - Added comments. - Changed assert for the unit status after the manager ran. Co-authored-by: PietroPasotti Signed-off-by: Math Marchand Signed-off-by: Mathieu Marchand * Graceful teardown (#103) * updated restart logic and added stop if not ready * fixed utest * fmt and layer fix * added layer replace * vbump * simplified layer-stop mechanism * Graceful teardown (fix static checks) (#104) * updated restart logic and added stop if not ready * fixed utest * fmt and layer fix * added layer replace * vbump * simplified layer-stop mechanism * type ignore --------- Signed-off-by: Mathieu Marchand Signed-off-by: Math Marchand Co-authored-by: PietroPasotti Co-authored-by: PietroPasotti --- .../test_coordinator.py | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/tests/test_coordinated_workers/test_coordinator.py b/tests/test_coordinated_workers/test_coordinator.py index ce03401..ca4c466 100644 --- a/tests/test_coordinated_workers/test_coordinator.py +++ b/tests/test_coordinated_workers/test_coordinator.py @@ -281,3 +281,66 @@ def test_tracing_receivers_urls( "otlp_http": "5.6.7.8:4318", "otlp_grpc": "5.6.7.8:4317", } + + +@pytest.mark.parametrize( + "event", + ( + testing.CharmEvents.update_status(), + testing.CharmEvents.start(), + testing.CharmEvents.install(), + testing.CharmEvents.config_changed(), + ), +) +def test_invalid_databag_content(coordinator_charm: ops.CharmBase, event): + # Test Invalid relations databag for ClusterProvider.gather_addresses_by_role + + # GIVEN a coordinator charm with a cluster relation and invalid remote databag contents + requires_relations = { + endpoint: testing.Relation(endpoint=endpoint, interface=interface["interface"]) + for endpoint, interface in { + "my-certificates": {"interface": "certificates"}, + "my-logging": {"interface": "loki_push_api"}, + "my-charm-tracing": {"interface": "tracing"}, + "my-workload-tracing": {"interface": "tracing"}, + }.items() + } + requires_relations["cluster_worker0"] = testing.Relation( + "my-cluster", + remote_app_name="worker0", + remote_app_data=ClusterRequirerAppData(role="read").dump(), + ) + requires_relations["cluster_worker1"] = testing.Relation( + "my-cluster", + remote_app_name="worker1", + remote_app_data=ClusterRequirerAppData(role="read").dump(), + ) + requires_relations["cluster_worker2"] = testing.Relation( + "my-cluster", + remote_app_name="worker2", + ) + + provides_relations = { + endpoint: testing.Relation(endpoint=endpoint, interface=interface["interface"]) + for endpoint, interface in { + "my-dashboards": {"interface": "grafana_dashboard"}, + "my-metrics": {"interface": "prometheus_scrape"}, + }.items() + } + + invalid_databag_state = testing.State( + containers={ + testing.Container("nginx", can_connect=True), + testing.Container("nginx-prometheus-exporter", can_connect=True), + }, + relations=list(requires_relations.values()) + list(provides_relations.values()), + ) + + # WHEN: the coordinator processes any event + ctx = testing.Context(coordinator_charm, meta=coordinator_charm.META) + with ctx(event, invalid_databag_state) as manager: + cluster = manager.charm.coordinator.cluster + # THEN the coordinator sets unit to blocked since the cluster is inconsistent with the missing relation. + cluster.gather_addresses_by_role() + manager.run() + assert cluster.model.unit.status == ops.BlockedStatus("[consistency] Cluster inconsistent.") From 526140a08920b1ac8d7787413d35b1058fe03ecd Mon Sep 17 00:00:00 2001 From: Luca Bello <36242061+lucabello@users.noreply.github.com> Date: Tue, 26 Nov 2024 11:22:23 +0100 Subject: [PATCH 2/3] fix: add 25.04 label to issue sync (#106) Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com> --- .github/.jira_sync_config.yaml | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/.github/.jira_sync_config.yaml b/.github/.jira_sync_config.yaml index fc15830..168bdf5 100644 --- a/.github/.jira_sync_config.yaml +++ b/.github/.jira_sync_config.yaml @@ -7,27 +7,16 @@ settings: components: - cos-lib - - team-observability - - add_gh_comment: false - sync_description: false - sync_comments: false - - label_mapping: -settings: - jira_project_key: "OPENG" - status_mapping: - opened: Untriaged - closed: done - not_planned: rejected - - components: - - catalogue - team-core + - team-mesh + - team-tracing + + labels: + - 25.04 add_gh_comment: false sync_description: false sync_comments: false label_mapping: - "Type: Enhancement": Story \ No newline at end of file + "Type: Enhancement": Story From 02e15b7320a851c18e35415e95f48a4b4fa10251 Mon Sep 17 00:00:00 2001 From: Luca Bello <36242061+lucabello@users.noreply.github.com> Date: Wed, 27 Nov 2024 10:43:34 +0100 Subject: [PATCH 3/3] fix: remove labels from issue sync Signed-off-by: Luca Bello <36242061+lucabello@users.noreply.github.com> --- .github/.jira_sync_config.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/.jira_sync_config.yaml b/.github/.jira_sync_config.yaml index 168bdf5..fbcff08 100644 --- a/.github/.jira_sync_config.yaml +++ b/.github/.jira_sync_config.yaml @@ -9,10 +9,7 @@ settings: - cos-lib - team-core - team-mesh - - team-tracing - - labels: - - 25.04 + - team-tracin add_gh_comment: false sync_description: false