Skip to content

Commit af365e7

Browse files
committed
Fix show-status tests by using status command instead.
1 parent 6a9623b commit af365e7

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

acceptancetests/jujupy/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ def preferred_container(cls):
651651
if container_type in cls.supported_container_types:
652652
return container_type
653653

654-
_show_status = 'show-status'
654+
_show_status = 'status'
655655
_show_controller = 'show-controller'
656656

657657
@classmethod

acceptancetests/jujupy/fake.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,7 @@ def get_juju_output(self, command, args, used_feature_flags, juju_home,
10501050
self.controller_state.add_user_perms(username, permissions)
10511051
register_string = get_user_register_command_info(username)
10521052
return info_string + register_string
1053-
if command == 'show-status':
1053+
if command == 'status':
10541054
status_dict = model_state.get_status_dict()
10551055
# Parsing JSON is much faster than parsing YAML, and JSON is a
10561056
# subset of YAML, so emit JSON.

acceptancetests/jujupy/tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,7 @@ def test_get_status(self):
785785
return_value=output_text) as gjo_mock:
786786
result = client.get_status()
787787
gjo_mock.assert_called_once_with(
788-
'show-status', '--format', 'yaml', controller=False)
788+
'status', '--format', 'yaml', controller=False)
789789
self.assertEqual(Status, type(result))
790790
self.assertEqual(['a', 'b', 'c'], result.status)
791791

@@ -2017,7 +2017,7 @@ def test_wait_for_ha(self):
20172017
return_value=value) as gjo_mock:
20182018
client.wait_for_ha()
20192019
gjo_mock.assert_called_once_with(
2020-
'show-status', '--format', 'yaml', controller=False)
2020+
'status', '--format', 'yaml', controller=False)
20212021

20222022
def test_wait_for_ha_requires_controller_client(self):
20232023
client = fake_juju_client()

acceptancetests/tests/test_deploy_stack.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def test_safe_print_status(self):
138138
with patch.object(client, 'iter_model_clients',
139139
return_value=[client]) as imc_mock:
140140
safe_print_status(client)
141-
mock.assert_called_once_with('show-status', ('--format', 'yaml'))
141+
mock.assert_called_once_with('status', ('--format', 'yaml'))
142142
imc_mock.assert_called_once_with()
143143

144144
def test_safe_print_status_ignores_soft_deadline(self):
@@ -855,7 +855,7 @@ def test_deploy_dummy_stack(self):
855855
def output(*args, **kwargs):
856856
token_file = '/var/run/dummy-sink/token'
857857
output = {
858-
('show-status', '--format', 'yaml'): status,
858+
('status', '--format', 'yaml'): status,
859859
('ssh', 'dummy-sink/0', 'cat', token_file): 'fake-token',
860860
}
861861
return output[args]
@@ -882,7 +882,7 @@ def output(*args, **kwargs):
882882
self.assertEqual(cc_mock.call_count, 4)
883883
self.assertEqual(
884884
[
885-
call('show-status', '--format', 'yaml', controller=False)
885+
call('status', '--format', 'yaml', controller=False)
886886
],
887887
gjo_mock.call_args_list)
888888

@@ -1041,10 +1041,10 @@ class TestTestUpgrade(FakeHomeTestCase):
10411041
'juju', '--show-log', 'exec', '--format', 'json',
10421042
'--application', 'dummy-source,dummy-sink', 'uname')
10431043
STATUS = (
1044-
'juju', '--show-log', 'show-status', '-m', 'foo:foo',
1044+
'juju', '--show-log', 'status', '-m', 'foo:foo',
10451045
'--format', 'yaml')
10461046
CONTROLLER_STATUS = (
1047-
'juju', '--show-log', 'show-status', '-m', 'foo:controller',
1047+
'juju', '--show-log', 'status', '-m', 'foo:controller',
10481048
'--format', 'yaml')
10491049
GET_ENV = ('juju', '--show-log', 'model-config', '-m', 'foo:foo',
10501050
'agent-metadata-url')
@@ -1106,7 +1106,7 @@ def test_assess_upgrade(self):
11061106
'juju', '--show-log', 'upgrade-juju', '-m', 'foo:controller',
11071107
'--agent-version', '2.0-rc2'), 0)
11081108
assert_juju_call(self, cc_mock, new_client, (
1109-
'juju', '--show-log', 'show-status', '-m', 'foo:controller',
1109+
'juju', '--show-log', 'status', '-m', 'foo:controller',
11101110
'--format', 'yaml'), 1)
11111111
assert_juju_call(self, cc_mock, new_client, (
11121112
'juju', '--show-log', 'list-models', '-c', 'foo'), 2)
@@ -2032,10 +2032,10 @@ def test_bootstrap_context(self):
20322032
assert_juju_call(self, cc_mock, client, (
20332033
'path', '--show-log', 'list-models', '-c', 'bar'), 2)
20342034
assert_juju_call(self, cc_mock, client, (
2035-
'path', '--show-log', 'show-status', '-m', 'bar:controller',
2035+
'path', '--show-log', 'status', '-m', 'bar:controller',
20362036
'--format', 'yaml'), 3)
20372037
assert_juju_call(self, cc_mock, client, (
2038-
'path', '--show-log', 'show-status', '-m', 'bar:bar',
2038+
'path', '--show-log', 'status', '-m', 'bar:bar',
20392039
'--format', 'yaml'), 4)
20402040

20412041
def test_keep_env(self):
@@ -2056,10 +2056,10 @@ def test_keep_env(self):
20562056
assert_juju_call(self, cc_mock, client, (
20572057
'path', '--show-log', 'list-models', '-c', 'bar'), 2)
20582058
assert_juju_call(self, cc_mock, client, (
2059-
'path', '--show-log', 'show-status', '-m', 'bar:controller',
2059+
'path', '--show-log', 'status', '-m', 'bar:controller',
20602060
'--format', 'yaml'), 3)
20612061
assert_juju_call(self, cc_mock, client, (
2062-
'path', '--show-log', 'show-status', '-m', 'bar:bar',
2062+
'path', '--show-log', 'status', '-m', 'bar:bar',
20632063
'--format', 'yaml'), 4)
20642064

20652065
def test_upload_tools(self):
@@ -2148,7 +2148,7 @@ def test_region(self):
21482148
self.assertEqual('steve', client.env.get_region())
21492149

21502150
def test_status_error_raises(self):
2151-
"""An error on final show-status propagates so an assess will fail."""
2151+
"""An error on final status propagates so an assess will fail."""
21522152
error = subprocess.CalledProcessError(1, ['juju'], '')
21532153
effects = [None, None, None, None, None, None, error]
21542154
cc_mock = self.addContext(patch('subprocess.check_call', autospec=True,
@@ -2172,10 +2172,10 @@ def test_status_error_raises(self):
21722172
assert_juju_call(self, cc_mock, client, (
21732173
'path', '--show-log', 'list-models', '-c', 'bar'), 2)
21742174
assert_juju_call(self, cc_mock, client, (
2175-
'path', '--show-log', 'show-status', '-m', 'bar:controller',
2175+
'path', '--show-log', 'status', '-m', 'bar:controller',
21762176
'--format', 'yaml'), 3)
21772177
assert_juju_call(self, cc_mock, client, (
2178-
'path', '--show-log', 'show-status', '-m', 'bar:bar',
2178+
'path', '--show-log', 'status', '-m', 'bar:bar',
21792179
'--format', 'yaml'), 4)
21802180

21812181

0 commit comments

Comments
 (0)