diff options
author | Jose Luis Vazquez Gonzalez (Jose Vazquez) <jose.vazquez@canonical.com> | 2016-12-19 18:11:33 +0100 |
---|---|---|
committer | usd-importer <ubuntu-server@lists.ubuntu.com> | 2016-12-20 10:38:16 +0000 |
commit | 7b69971ddad188fe3de1303f15dc7e87ebbcd0fb (patch) | |
tree | 33217746d0c39496230f7b54753cad70c0b81125 /tests/ga/test_update.py | |
parent | cc919bdf975f35092f0e85fc301d5661eb661986 (diff) | |
download | vyos-walinuxagent-7b69971ddad188fe3de1303f15dc7e87ebbcd0fb.tar.gz vyos-walinuxagent-7b69971ddad188fe3de1303f15dc7e87ebbcd0fb.zip |
Fix potential infinite loop in agent updating
Gbp-Pq: fix-auto-update.patch.
Diffstat (limited to 'tests/ga/test_update.py')
-rw-r--r-- | tests/ga/test_update.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/ga/test_update.py b/tests/ga/test_update.py index 74804fb..89fe95d 100644 --- a/tests/ga/test_update.py +++ b/tests/ga/test_update.py @@ -797,14 +797,14 @@ class TestUpdate(UpdateTestCase): self.assertEqual(len(get_agents(self.tmp_dir)), len(self.update_handler.agents)) return - def test_load_agents_does_not_reload(self): + def test_load_agents_does_reload(self): self.prepare_agents() self.update_handler._load_agents() agents = self.update_handler.agents self.update_handler._load_agents() - self.assertEqual(agents, self.update_handler.agents) + self.assertNotEqual(agents, self.update_handler.agents) return def test_load_agents_sorts(self): @@ -945,7 +945,8 @@ class TestUpdate(UpdateTestCase): self.assertEqual(0.0, latest_agent.error.last_failure) self.assertEqual(0, latest_agent.error.failure_count) - self._test_run_latest(mock_child=ChildMock(return_value=1)) + with patch('azurelinuxagent.ga.update.UpdateHandler.get_latest_agent', return_value=latest_agent): + self._test_run_latest(mock_child=ChildMock(return_value=1)) self.assertTrue(latest_agent.is_available) self.assertNotEqual(0.0, latest_agent.error.last_failure) @@ -961,7 +962,8 @@ class TestUpdate(UpdateTestCase): self.assertEqual(0.0, latest_agent.error.last_failure) self.assertEqual(0, latest_agent.error.failure_count) - self._test_run_latest(mock_child=ChildMock(side_effect=Exception("Force blacklisting"))) + with patch('azurelinuxagent.ga.update.UpdateHandler.get_latest_agent', return_value=latest_agent): + self._test_run_latest(mock_child=ChildMock(side_effect=Exception("Force blacklisting"))) self.assertFalse(latest_agent.is_available) self.assertTrue(latest_agent.error.is_blacklisted) |