Skip to content

Commit

Permalink
twa: Modify charm message when there is no ingress relation
Browse files Browse the repository at this point in the history
Modify charm message when there is no ingress relation available.
  • Loading branch information
orfeas-k committed Jun 26, 2023
1 parent 8d06d32 commit 6b3c749
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charms/tensorboards-web-app/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _configure_mesh(self, interfaces) -> None:
}
)
else:
raise ErrorWithStatus("No ingress relation available", BlockedStatus)
raise ErrorWithStatus("Please relate to istio-pilot:ingress", BlockedStatus)

def _check_leader(self) -> None:
"""Check if this unit is a leader."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def test_build_and_deploy(ops_test: OpsTest):

unit = ops_test.model.applications[APP_NAME].units[0]
assert unit.workload_status == "blocked"
assert unit.workload_status_message == "No ingress relation available"
assert unit.workload_status_message == "Please relate to istio-pilot:ingress"


@pytest.mark.abort_on_fail
Expand Down
4 changes: 3 additions & 1 deletion charms/tensorboards-web-app/tests/unit/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ def test_no_relation(self, k8s_resource_handler: MagicMock, harness: Harness):
"""Test that charm is blocked when there is no ingress relation."""
harness.set_leader(True)
harness.begin_with_initial_hooks()
assert harness.charm.model.unit.status == BlockedStatus("No ingress relation available")
assert harness.charm.model.unit.status == BlockedStatus(
"Please relate to istio-pilot:ingress"
)

@patch("charm.KubernetesServicePatch", lambda x, y, service_name: None)
@patch("charm.TensorboardsWebApp.k8s_resource_handler")
Expand Down

0 comments on commit 6b3c749

Please sign in to comment.