summaryrefslogtreecommitdiff
path: root/tests/cloud_tests/testcases
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2018-04-07 15:03:26 -0600
committerChad Smith <chad.smith@canonical.com>2018-04-07 15:03:26 -0600
commit01ff5c2eae9fc75beab3bc1368e17a7278dc0905 (patch)
tree8ac15c8f5179fae11f8d13aecebb0725d5d8365b /tests/cloud_tests/testcases
parent05926e48eae0fa70a26da6449617e04e87c4e704 (diff)
downloadvyos-cloud-init-01ff5c2eae9fc75beab3bc1368e17a7278dc0905.tar.gz
vyos-cloud-init-01ff5c2eae9fc75beab3bc1368e17a7278dc0905.zip
tests: fix ec2 integration network metadata validation
Fix integraiton test logic for ec2 to look for network and availability-zone data under the key path 'ds'=>'meta-data' instead of just 'ds' when parsing instance-data.json.
Diffstat (limited to 'tests/cloud_tests/testcases')
-rw-r--r--tests/cloud_tests/testcases/base.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/cloud_tests/testcases/base.py b/tests/cloud_tests/testcases/base.py
index 324c7c91..7598d469 100644
--- a/tests/cloud_tests/testcases/base.py
+++ b/tests/cloud_tests/testcases/base.py
@@ -149,7 +149,10 @@ class CloudTestCase(unittest.TestCase):
self.assertEqual(
['ds/user-data'], instance_data['base64-encoded-keys'])
ds = instance_data.get('ds', {})
- macs = ds.get('network', {}).get('interfaces', {}).get('macs', {})
+ v1_data = instance_data.get('v1', {})
+ metadata = ds.get('meta-data', {})
+ macs = metadata.get(
+ 'network', {}).get('interfaces', {}).get('macs', {})
if not macs:
raise AssertionError('No network data from EC2 meta-data')
# Check meta-data items we depend on
@@ -160,10 +163,8 @@ class CloudTestCase(unittest.TestCase):
for key in expected_net_keys:
self.assertIn(key, mac_data)
self.assertIsNotNone(
- ds.get('placement', {}).get('availability-zone'),
+ metadata.get('placement', {}).get('availability-zone'),
'Could not determine EC2 Availability zone placement')
- ds = instance_data.get('ds', {})
- v1_data = instance_data.get('v1', {})
self.assertIsNotNone(
v1_data['availability-zone'], 'expected ec2 availability-zone')
self.assertEqual('aws', v1_data['cloud-name'])