summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnh Vo <anhvo@microsoft.com>2019-05-08 14:54:03 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-05-08 14:54:03 +0000
commitab6621d849b24bb652243e88c79f6f3b446048d7 (patch)
tree5a4357d46ef06cc75bf3a6599798b38b2bfab8b1 /tests
parent86674f013dfcea3c075ab41373ffb475881066f6 (diff)
downloadvyos-cloud-init-ab6621d849b24bb652243e88c79f6f3b446048d7.tar.gz
vyos-cloud-init-ab6621d849b24bb652243e88c79f6f3b446048d7.zip
DataSourceAzure: Adjust timeout for polling IMDS
If the IMDS primary server is not available, falling back to the secondary server takes about 1s. The net result is that the expected E2E time is slightly more than 1s. This change increases the timeout to 2s to prevent the infinite loop of timeouts.
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_datasource/test_azure.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index ab77c034..427ab7e7 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -163,7 +163,8 @@ class TestGetMetadataFromIMDS(HttprettyTestCase):
m_readurl.assert_called_with(
self.network_md_url, exception_cb=mock.ANY,
- headers={'Metadata': 'true'}, retries=2, timeout=1)
+ headers={'Metadata': 'true'}, retries=2,
+ timeout=dsaz.IMDS_TIMEOUT_IN_SECONDS)
@mock.patch('cloudinit.url_helper.time.sleep')
@mock.patch(MOCKPATH + 'net.is_up')
@@ -1791,7 +1792,8 @@ class TestAzureDataSourcePreprovisioning(CiTestCase):
headers={'Metadata': 'true',
'User-Agent':
'Cloud-Init/%s' % vs()
- }, method='GET', timeout=1,
+ }, method='GET',
+ timeout=dsaz.IMDS_TIMEOUT_IN_SECONDS,
url=full_url)])
self.assertEqual(m_dhcp.call_count, 2)
m_net.assert_any_call(
@@ -1828,7 +1830,9 @@ class TestAzureDataSourcePreprovisioning(CiTestCase):
headers={'Metadata': 'true',
'User-Agent':
'Cloud-Init/%s' % vs()},
- method='GET', timeout=1, url=full_url)])
+ method='GET',
+ timeout=dsaz.IMDS_TIMEOUT_IN_SECONDS,
+ url=full_url)])
self.assertEqual(m_dhcp.call_count, 2)
m_net.assert_any_call(
broadcast='192.168.2.255', interface='eth9', ip='192.168.2.9',