Skip to content

Commit

Permalink
Merge branch 'main' into charm-tracing-config-blocked
Browse files Browse the repository at this point in the history
  • Loading branch information
PietroPasotti authored Nov 29, 2024
2 parents f730fcc + 02e15b7 commit 1bd4e53
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 17 deletions.
20 changes: 3 additions & 17 deletions .github/.jira_sync_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,13 @@ 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-tracin

add_gh_comment: false
sync_description: false
sync_comments: false

label_mapping:
"Type: Enhancement": Story
"Type: Enhancement": Story
63 changes: 63 additions & 0 deletions tests/test_coordinated_workers/test_coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

0 comments on commit 1bd4e53

Please sign in to comment.