Selaa lähdekoodia

Provide custom AMIs for use with moto

Requires https://github.com/spulec/moto/pull/1379
Enis Afgan 8 vuotta sitten
vanhempi
sitoutus
eae1d97019
3 muutettua tiedostoa jossa 22 lisäystä ja 1 poistoa
  1. 19 0
      test/fixtures/custom_amis.json
  2. 2 1
      test/helpers/__init__.py
  3. 1 0
      tox.ini

+ 19 - 0
test/fixtures/custom_amis.json

@@ -0,0 +1,19 @@
+[
+  {
+    "ami_id": "ami-aa2ea6d0",
+    "state": "available",
+    "public": true,
+    "owner_id": "099720109477",
+    "image_location": "amazon/getting-started",
+    "sriov": "simple",
+    "root_device_type": "ebs",
+    "root_device_name": "/dev/sda1",
+    "description": "Canonical, Ubuntu, 16.04 LTS, amd64 xenial image build on 2017-11-21",
+    "image_type": "machine",
+    "platform": null,
+    "architecture": "x86_64",
+    "name": "ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-20171121.1",
+    "virtualization_type": "hvm",
+    "hypervisor": "xen"
+  }
+]

+ 2 - 1
test/helpers/__init__.py

@@ -79,7 +79,8 @@ def skipIfNoService(services):
 
 TEST_DATA_CONFIG = {
     "AWSCloudProvider": {
-        "image": os.environ.get('CB_IMAGE_AWS', 'ami-5ac2cd4d'),
+        # Match the ami value with entry in custom_amis.json for use with moto
+        "image": os.environ.get('CB_IMAGE_AWS', 'ami-aa2ea6d0'),
         "vm_type": os.environ.get('CB_VM_TYPE_AWS', 't2.nano'),
         "placement": os.environ.get('CB_PLACEMENT_AWS', 'us-east-1a'),
     },

+ 1 - 0
tox.ini

@@ -18,6 +18,7 @@ envlist = {py27,py36,pypy}-{aws,azure,openstack}
 commands = flake8 cloudbridge test setup.py
            {envpython} -m coverage run --branch --source=cloudbridge --omit=cloudbridge/cloud/interfaces/* setup.py test {posargs}
 setenv =
+    MOTO_AMIS_PATH=./test/fixtures/custom_amis.json
     aws: CB_TEST_PROVIDER=aws
     azure: CB_TEST_PROVIDER=azure
     openstack: CB_TEST_PROVIDER=openstack