diff options
author | Daniel Watkins <daniel.watkins@canonical.com> | 2015-05-08 16:52:49 +0100 |
---|---|---|
committer | Daniel Watkins <daniel.watkins@canonical.com> | 2015-05-08 16:52:49 +0100 |
commit | 512eb552e0ca740e1d285dc1b66a56579bcf68ec (patch) | |
tree | b47f5203d9cf60f2d6e5737303e8feb6fed2ad73 /tests/unittests/test_datasource/test_azure_helper.py | |
parent | d8a1910ae79478b8976c4950219d37e15640e7e7 (diff) | |
download | vyos-cloud-init-512eb552e0ca740e1d285dc1b66a56579bcf68ec.tar.gz vyos-cloud-init-512eb552e0ca740e1d285dc1b66a56579bcf68ec.zip |
Fix retrying.
Diffstat (limited to 'tests/unittests/test_datasource/test_azure_helper.py')
-rw-r--r-- | tests/unittests/test_datasource/test_azure_helper.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_azure_helper.py b/tests/unittests/test_datasource/test_azure_helper.py index 5fac2ade..23bc997c 100644 --- a/tests/unittests/test_datasource/test_azure_helper.py +++ b/tests/unittests/test_datasource/test_azure_helper.py @@ -323,6 +323,8 @@ class TestWALinuxAgentShim(TestCase): mock.patch.object(azure_helper, 'iid_from_shared_config_content')) self.OpenSSLManager = patches.enter_context( mock.patch.object(azure_helper, 'OpenSSLManager')) + patches.enter_context( + mock.patch.object(azure_helper.time, 'sleep', mock.MagicMock())) def test_http_client_uses_certificate(self): shim = azure_helper.WALinuxAgentShim() @@ -402,6 +404,15 @@ class TestWALinuxAgentShim(TestCase): self.assertEqual( 1, self.OpenSSLManager.return_value.clean_up.call_count) + def test_failure_to_fetch_goalstate_bubbles_up(self): + class SentinelException(Exception): + pass + self.AzureEndpointHttpClient.return_value.get.side_effect = ( + SentinelException) + shim = azure_helper.WALinuxAgentShim() + self.assertRaises(SentinelException, + shim.register_with_azure_and_fetch_data) + class TestGetMetadataFromFabric(TestCase): |