Chad Smith has proposed merging ~chad.smith/cloud-init:fix/cloud-tests-ec2 into 
cloud-init:master.

Commit message:
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.

Requested reviews:
  Server Team CI bot (server-team-bot): continuous-integration
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/342830
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:fix/cloud-tests-ec2 into cloud-init:master.
diff --git a/tests/cloud_tests/testcases/base.py b/tests/cloud_tests/testcases/base.py
index 324c7c9..05963c7 100644
--- a/tests/cloud_tests/testcases/base.py
+++ b/tests/cloud_tests/testcases/base.py
@@ -149,7 +149,9 @@ 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 +162,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'])
_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to