Merge "Add test for referencing cloud image by ID"
This commit is contained in:
commit
8cb7b1f8f4
|
@ -107,7 +107,10 @@ class FakeOpenStackCloud(object):
|
|||
def _get(self, name_or_id, instance_list):
|
||||
self.log.debug("Get %s in %s" % (name_or_id, repr(instance_list)))
|
||||
for instance in instance_list:
|
||||
if instance.name == name_or_id or instance.id == name_or_id:
|
||||
if isinstance(name_or_id, dict):
|
||||
if instance.id == name_or_id['id']:
|
||||
return instance
|
||||
elif instance.name == name_or_id or instance.id == name_or_id:
|
||||
return instance
|
||||
return None
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
build-log-dir: '{build_log_dir}'
|
||||
|
||||
zookeeper-servers:
|
||||
- host: {zookeeper_host}
|
||||
port: {zookeeper_port}
|
||||
chroot: {zookeeper_chroot}
|
||||
|
||||
labels:
|
||||
- name: fake-label
|
||||
min-ready: 1
|
||||
|
||||
providers:
|
||||
- name: fake-provider
|
||||
cloud: fake
|
||||
driver: fake
|
||||
region-name: fake-region
|
||||
rate: 0.0001
|
||||
cloud-images:
|
||||
- name: fake-image
|
||||
image-id: 'fake-image-id'
|
||||
pools:
|
||||
- name: main
|
||||
max-servers: 96
|
||||
labels:
|
||||
- name: fake-label
|
||||
cloud-image: fake-image
|
||||
min-ram: 8192
|
|
@ -1000,6 +1000,18 @@ class TestLauncher(tests.DBTestCase):
|
|||
nodes = self.waitForNodes('fake-label')
|
||||
self.assertEqual(len(nodes), 1)
|
||||
|
||||
def test_unmanaged_image_provider_id(self):
|
||||
"""
|
||||
Test node launching using an unmanaged image referencing the
|
||||
image ID as known by the provider.
|
||||
"""
|
||||
configfile = self.setup_config('unmanaged_image_provider_id.yaml')
|
||||
pool = self.useNodepool(configfile, watermark_sleep=1)
|
||||
pool.start()
|
||||
self.log.debug("Waiting for node")
|
||||
nodes = self.waitForNodes('fake-label')
|
||||
self.assertEqual(len(nodes), 1)
|
||||
|
||||
def test_paused_gets_declined(self):
|
||||
"""Test that a paused request, that later gets declined, unpauses."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue