Merge fping functional tests between v2 and v2.1

Currently v2 and v2.1 have separate functional tests and their
corresponding sample files. As v2 and v2.1 are supposed to be identical,
there is overhead to maintain two set of functional tests and sample files.
We can have one set of tests which can run for both v2 and v2.1.

This commit merges fping functional tests.

In V2.1 os-access-ip is separate plugin where in v2 it was mixed in server
plugin itself. So os-access-ip extension is enabled tests to run
merged functional tests for both v2 and v2.1.

Change-Id: I1dd91402c38736accea0e9b73be66a9aaa72c4f3
This commit is contained in:
ghanshyam
2015-04-10 12:20:22 +09:00
parent b6e5d68c66
commit 1eb49afbba
6 changed files with 17 additions and 60 deletions

View File

@@ -1,7 +0,0 @@
{
"server": {
"alive": false,
"id": "f5e6fd6d-c0a3-4f9e-aabf-d69196b6d11a",
"project_id": "openstack"
}
}

View File

@@ -1,9 +0,0 @@
{
"servers": [
{
"alive": false,
"id": "1d1aea35-472b-40cf-9337-8eb68480aaa1",
"project_id": "openstack"
}
]
}

View File

@@ -1,7 +0,0 @@
{
"server": {
"alive": false,
"id": "%(uuid)s",
"project_id": "openstack"
}
}

View File

@@ -1,9 +0,0 @@
{
"servers": [
{
"alive": false,
"id": "%(uuid)s",
"project_id": "openstack"
}
]
}

View File

@@ -29,7 +29,6 @@ from oslo_utils import timeutils
import testtools import testtools
from nova.api.metadata import password from nova.api.metadata import password
from nova.api.openstack.compute.contrib import fping
from nova.api.openstack.compute import extensions from nova.api.openstack.compute import extensions
from nova.cells import utils as cells_utils from nova.cells import utils as cells_utils
# Import extensions to pull in osapi_compute_extension CONF option used below. # Import extensions to pull in osapi_compute_extension CONF option used below.
@@ -45,12 +44,10 @@ from nova.servicegroup import api as service_group_api
from nova import test from nova import test
from nova.tests.functional import api_samples_test_base from nova.tests.functional import api_samples_test_base
from nova.tests.functional import integrated_helpers from nova.tests.functional import integrated_helpers
from nova.tests.unit.api.openstack.compute.contrib import test_fping
from nova.tests.unit.api.openstack import fakes from nova.tests.unit.api.openstack import fakes
from nova.tests.unit import fake_network from nova.tests.unit import fake_network
from nova.tests.unit import fake_utils from nova.tests.unit import fake_utils
from nova.tests.unit.image import fake from nova.tests.unit.image import fake
from nova import utils
from nova.volume import cinder from nova.volume import cinder
CONF = cfg.CONF CONF = cfg.CONF
@@ -1023,31 +1020,6 @@ class BlockDeviceMappingV2BootJsonTest(ServersSampleBase):
return self._post_server() return self._post_server()
class FpingSampleJsonTests(ServersSampleBase):
extension_name = ("nova.api.openstack.compute.contrib.fping.Fping")
def setUp(self):
super(FpingSampleJsonTests, self).setUp()
def fake_check_fping(self):
pass
self.stubs.Set(utils, "execute", test_fping.execute)
self.stubs.Set(fping.FpingController, "check_fping",
fake_check_fping)
def test_get_fping(self):
self._post_server()
response = self._do_get('os-fping')
subs = self._get_regexes()
self._verify_response('fping-get-resp', subs, response, 200)
def test_get_fping_details(self):
uuid = self._post_server()
response = self._do_get('os-fping/%s' % (uuid))
subs = self._get_regexes()
self._verify_response('fping-get-details-resp', subs, response, 200)
class ExtendedAvailabilityZoneJsonTests(ServersSampleBase): class ExtendedAvailabilityZoneJsonTests(ServersSampleBase):
extension_name = ("nova.api.openstack.compute.contrib" extension_name = ("nova.api.openstack.compute.contrib"
".extended_availability_zone" ".extended_availability_zone"

View File

@@ -13,15 +13,30 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from oslo_config import cfg
from nova.api.openstack.compute.contrib import fping as fping_v2
from nova.api.openstack.compute.plugins.v3 import fping from nova.api.openstack.compute.plugins.v3 import fping
from nova.tests.functional.v3 import test_servers from nova.tests.functional.v3 import test_servers
from nova.tests.unit.api.openstack.compute.contrib import test_fping from nova.tests.unit.api.openstack.compute.contrib import test_fping
from nova import utils from nova import utils
CONF = cfg.CONF
CONF.import_opt('osapi_compute_extension',
'nova.api.openstack.compute.extensions')
class FpingSampleJsonTests(test_servers.ServersSampleBase): class FpingSampleJsonTests(test_servers.ServersSampleBase):
extension_name = "os-fping" extension_name = "os-fping"
extra_extensions_to_load = ["os-access-ips"]
_api_version = 'v2'
def _get_flags(self):
f = super(FpingSampleJsonTests, self)._get_flags()
f['osapi_compute_extension'] = CONF.osapi_compute_extension[:]
f['osapi_compute_extension'].append(
'nova.api.openstack.compute.contrib.fping.Fping')
return f
def setUp(self): def setUp(self):
super(FpingSampleJsonTests, self).setUp() super(FpingSampleJsonTests, self).setUp()
@@ -31,6 +46,8 @@ class FpingSampleJsonTests(test_servers.ServersSampleBase):
self.stubs.Set(utils, "execute", test_fping.execute) self.stubs.Set(utils, "execute", test_fping.execute)
self.stubs.Set(fping.FpingController, "check_fping", self.stubs.Set(fping.FpingController, "check_fping",
fake_check_fping) fake_check_fping)
self.stubs.Set(fping_v2.FpingController, "check_fping",
fake_check_fping)
def test_get_fping(self): def test_get_fping(self):
self._post_server() self._post_server()