summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource
diff options
context:
space:
mode:
authorMarkus Schade <markus.schade@hetzner.com>2020-10-30 19:12:25 +0100
committerGitHub <noreply@github.com>2020-10-30 14:12:25 -0400
commit0f8be879073148f1d67094df9ec895a873caa0d7 (patch)
treebba27990e18b65930471b3ac34c5aab3d27c6137 /tests/unittests/test_datasource
parentf72d0cb7a03cc311700ea8795edf2454172c7414 (diff)
downloadvyos-cloud-init-0f8be879073148f1d67094df9ec895a873caa0d7.tar.gz
vyos-cloud-init-0f8be879073148f1d67094df9ec895a873caa0d7.zip
Hetzner: Fix instance_id / SMBIOS serial comparison (#640)
Fixes erroneous string/int comparison introduced in 1431c8a metadata['instance-id'] is an integer but the value read from smbios is a string. The comparision would cause TypeError.
Diffstat (limited to 'tests/unittests/test_datasource')
-rw-r--r--tests/unittests/test_datasource/test_hetzner.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/unittests/test_datasource/test_hetzner.py b/tests/unittests/test_datasource/test_hetzner.py
index fc3649a4..eadb92f1 100644
--- a/tests/unittests/test_datasource/test_hetzner.py
+++ b/tests/unittests/test_datasource/test_hetzner.py
@@ -80,7 +80,8 @@ class TestDataSourceHetzner(CiTestCase):
@mock.patch('cloudinit.sources.DataSourceHetzner.get_hcloud_data')
def test_read_data(self, m_get_hcloud_data, m_usermd, m_readmd,
m_fallback_nic, m_net):
- m_get_hcloud_data.return_value = (True, METADATA.get('instance-id'))
+ m_get_hcloud_data.return_value = (True,
+ str(METADATA.get('instance-id')))
m_readmd.return_value = METADATA.copy()
m_usermd.return_value = USERDATA
m_fallback_nic.return_value = 'eth0'