165
160
client.get_juju_output.return_value = '\n'*100
166
161
# Ensure that no exception is raised
167
assess_debug_log(client, timeout=120)
162
test_debug_log(client, timeout=120)
168
163
client.get_juju_output.assert_called_once_with(
169
164
"debug-log", "--lines=100", "--limit=100", timeout=120)
173
168
client.get_juju_output.return_value = ''
174
169
# Ensure that no exception is raised
175
170
with self.assertRaises(LogRotateError):
176
assess_debug_log(client)
171
test_debug_log(client)
177
172
client.get_juju_output.assert_called_once_with(
178
173
"debug-log", "--lines=100", "--limit=100", timeout=180)
181
class TestMachineRoation(TestCase):
183
def test_respects_machine_id_0(self):
184
client = fake_juju_client()
186
client.deploy('fill-logs')
187
with patch('assess_log_rotation.test_rotation') as tr_mock:
188
assess_machine_rotation(client)
189
tr_mock.assert_called_once_with(
190
client, '/var/log/juju/machine-0.log', 'machine-0', 'fill-machine',
191
'machine-size', 'megs=300', 'machine=0')
193
def test_respects_machine_id_1(self):
194
client = fake_juju_client_optional_jes(jes_enabled=False)
196
client.deploy('fill-logs')
197
with patch('assess_log_rotation.test_rotation') as tr_mock:
198
assess_machine_rotation(client)
199
tr_mock.assert_called_once_with(
200
client, '/var/log/juju/machine-1.log', 'machine-1',
201
'fill-machine', 'machine-size', 'megs=300', 'machine=1')
204
176
class TestParseArgs(TestCase):
206
178
def test_parse_args(self):