File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -38,7 +38,8 @@ async def is_subordinate(self, charm_name):
3838 url = "{}/v2/charms/info/{}?fields=default-release.revision.subordinate" .format (charmhub_url .value , charm_name )
3939 _response = await self .request_charmhub_with_retry (url , 5 )
4040 response = json .loads (_response .text )
41- return 'subordinate' in response ['default-release' ]['revision' ]
41+ rev_response = response ['default-release' ]['revision' ]
42+ return 'subordinate' in rev_response and rev_response ['subordinate' ]
4243
4344 # TODO (caner) : we should be able to recreate the channel-map through the
4445 # api call without needing the CharmHub facade
Original file line number Diff line number Diff line change @@ -121,6 +121,14 @@ async def test_subordinate_charm_zero_units(event_loop):
121121 assert len (app2 .units ) == 0
122122
123123
124+ @base .bootstrapped
125+ @pytest .mark .asyncio
126+ async def test_subordinate_false_field_exists (event_loop ):
127+ async with base .CleanModel () as model :
128+ assert await model .charmhub .is_subordinate ("rsyslog-forwarder-ha" )
129+ assert not await model .charmhub .is_subordinate ("mysql-innodb-cluster" )
130+
131+
124132@base .bootstrapped
125133@pytest .mark .asyncio
126134async def test_list_resources (event_loop ):
You can’t perform that action at this time.
0 commit comments