From 59a9b5559e5a531fb413512dd4a37356434bdf76 Mon Sep 17 00:00:00 2001 From: Yaroslav Lobankov Date: Sun, 31 Jan 2016 19:48:50 -0600 Subject: [PATCH] [Verify] Don't create new flavor when flavor already exists The current Tempest resources context creates a flavor in the cloud every time when we run the tests and even when we run only one test. It is not optimal. In order to avoid creating the flavor every time, before running tests Rally will try to discover flavor with the following properties: RAM = (64 or 128)MB, CPU = 1, disk = 0GB and, if the flavor is not discovered, Rally will create it. Change-Id: I920d5eebbd3dd6c00bd4d8ba915108e7b3e22e78 --- tests/unit/fakes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/fakes.py b/tests/unit/fakes.py index 8146b4a3..f234960b 100644 --- a/tests/unit/fakes.py +++ b/tests/unit/fakes.py @@ -118,11 +118,12 @@ class FakeServer(FakeResource): class FakeImage(FakeResource): def __init__(self, manager=None, id="image-id-0", min_ram=0, - size=0, min_disk=0, name=None): + size=0, min_disk=0, status="active", name=None): super(FakeImage, self).__init__(manager, id=id, name=name) self.min_ram = min_ram self.size = size self.min_disk = min_disk + self.status = status self.update = mock.MagicMock() @@ -158,11 +159,12 @@ class FakeNetwork(FakeResource): class FakeFlavor(FakeResource): - def __init__(self, id="flavor-id-0", manager=None, ram=0, disk=0, + def __init__(self, id="flavor-id-0", manager=None, ram=0, disk=0, vcpus=1, name="flavor-name-0"): super(FakeFlavor, self).__init__(manager, id=id) self.ram = ram self.disk = disk + self.vcpus = vcpus self.name = name