Merge ~rgildein/juju-verify:ceph/fix-list-pools into ~canonical-solutions-engineering/juju-verify:master

Proposed by Robert Gildein
Status: Merged
Approved by: Martin Kalcok
Approved revision: f181aa1aa186b956a7fe93123208eabd6efa6433
Merged at revision: 226c21fb6908c70836094c3308aebc96e1b4a2eb
Proposed branch: ~rgildein/juju-verify:ceph/fix-list-pools
Merge into: ~canonical-solutions-engineering/juju-verify:master
Diff against target: 35 lines (+4/-4)
2 files modified
juju_verify/verifiers/ceph.py (+2/-2)
tests/unit/verifiers/test_ceph.py (+2/-2)
Reviewer Review Type Date Requested Status
Martin Kalcok (community) Approve
🤖 prod-jenkaas-bootstack (community) continuous-integration Approve
Canonical Solutions Engineering Team Pending
Review via email: mp+400882@code.launchpad.net

Commit message

fix parsing output of "list-pools" action

The "list-pools" action has been changed back to a use "message" instead
of "pools" in action output.

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Robert Gildein (rgildein) wrote :

I tag it WIP, because of Billy's comment [1].

---
[1]: https://review.opendev.org/c/openstack/charm-ceph-mon/+/781714/6/actions.yaml#216

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :

A CI job is currently in progress. A follow up comment will be added when it completes.

Revision history for this message
🤖 prod-jenkaas-bootstack (prod-jenkaas-bootstack) wrote :
review: Approve (continuous-integration)
Revision history for this message
Martin Kalcok (martin-kalcok) wrote :

LGTM

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 226c21fb6908c70836094c3308aebc96e1b4a2eb

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/juju_verify/verifiers/ceph.py b/juju_verify/verifiers/ceph.py
2index 7f43d84..f9fb0d2 100644
3--- a/juju_verify/verifiers/ceph.py
4+++ b/juju_verify/verifiers/ceph.py
5@@ -71,8 +71,8 @@ class CephCommon(BaseVerifier): # pylint: disable=W0223
6 :raises json.decoder.JSONDecodeError: if json.loads failed
7 """
8 verify_charm_unit("ceph-mon", unit)
9- action_map = run_action_on_units([unit], "list-pools", detail=True)
10- action_output = data_from_action(action_map.get(unit.entity_id), "pools")
11+ action_map = run_action_on_units([unit], "list-pools", format="json")
12+ action_output = data_from_action(action_map.get(unit.entity_id), "message")
13 logger.debug("parse information about pools: %s", action_output)
14 pools: List[Dict[str, Any]] = json.loads(action_output)
15
16diff --git a/tests/unit/verifiers/test_ceph.py b/tests/unit/verifiers/test_ceph.py
17index 08de557..91c5c7e 100644
18--- a/tests/unit/verifiers/test_ceph.py
19+++ b/tests/unit/verifiers/test_ceph.py
20@@ -86,7 +86,7 @@ def test_check_cluster_health_error(model):
21 def test_get_replication_number(mock_run_action_on_units, model):
22 """Test get minimum replication number from ceph-mon unit."""
23 action = MagicMock()
24- action.data.get.side_effect = {"results": {"pools": json.dumps([
25+ action.data.get.side_effect = {"results": {"message": json.dumps([
26 {"pool": 1, "name": "test_1", "size": 5, "min_size": 2},
27 {"pool": 2, "name": "test_2", "size": 5, "min_size": 2},
28 {"pool": 3, "name": "test_3", "size": 3, "min_size": 2},
29@@ -97,7 +97,7 @@ def test_get_replication_number(mock_run_action_on_units, model):
30 assert CephCommon.get_replication_number(model.units["ceph-mon/0"]) == 1
31
32 # test return None if list of pools is empty
33- action.data.get.side_effect = {"results": {"pools": json.dumps([])}}.get
34+ action.data.get.side_effect = {"results": {"message": json.dumps([])}}.get
35 assert CephCommon.get_replication_number(model.units["ceph-mon/0"]) is None
36
37

Subscribers

People subscribed via source and target branches