[LBaaS v2] Improve API tests performance

API tests shouldn't require booting real nova instances and can be
limited by creating DB entities. That is why it is beter to use
noop drivers for Octavia in API tests as it allows to significantly
accelerate test runs.

Changing interval_time in _wait_for_load_balancer_status method
from 10 sec to 1 sec allows to decrease test execution time while
keeping the average number of retries low (0 or 1).
Removed excessive _wait_for_load_balancer_status calls in tests.

Fixed operations order in
test_update_load_balancer_missing_admin_state_up,
test_update_load_balancer_missing_description and
test_update_load_balancer_missing_name.

Fixed gate_hook to take into account recent changes to the
apiv2 job structure.

Depends-On: Ia26bd8cb28dccbb021b2a2f64a9b7e6ef498ff4c
Change-Id: I4a5ea91ed63ddcc1c560cde94bd7d461aca3c49e
Closes-Bug: #1498532
Closes-Bug: #1497471
This commit is contained in:
Elena Ezhova 2015-09-22 18:03:38 +03:00
parent c7cc766c2b
commit 5765f29eaf
4 changed files with 22 additions and 34 deletions

View File

@ -3,13 +3,14 @@
set -ex
GATE_DEST=$BASE/new
DEVSTACK_PATH=$GATE_DEST/devstack
testenv=${2:-"apiv2"}
if [ "$1" = "lbaasv1" ]; then
testenv="apiv1"
elif [ "$1" = "lbaasv2" ]; then
if [ "$2" = "api" ]; then
if [ "$2" = "healthmonitor" ] || [ "$2" = "listener" ] || [ "$2" = "loadbalancer" ] || [ "$2" = "member" ] || [ "$2" = "pool" ]; then
testenv="apiv2"
elif [ "$2" = "scenario" ]; then
testenv="scenario"
@ -35,4 +36,17 @@ if [ "$testenv" != "apiv1" ]; then
export VOLUME_BACKING_FILE_SIZE
fi
if [ "$testenv" = "apiv2" ]; then
cat > $DEVSTACK_PATH/local.conf <<EOF
[[post-config|/etc/octavia/octavia.conf]]
[controller_worker]
amphora_driver = amphora_noop_driver
compute_driver = compute_noop_driver
network_driver = network_noop_driver
EOF
fi
$GATE_DEST/devstack-gate/devstack-vm-gate.sh

View File

@ -93,11 +93,8 @@ class BaseTestCase(base.BaseNetworkTest):
cls._try_delete_resource(cls.listeners_client.delete_listener,
listener.get('id'))
cls._wait_for_load_balancer_status(lb_id)
cls._try_delete_resource(
cls.load_balancers_client.delete_load_balancer, lb_id)
cls._try_delete_resource(cls._delete_load_balancer, lb_id)
for lb_id in cls._lbs_to_delete:
cls._wait_for_load_balancer_status(lb_id, delete=True)
super(BaseTestCase, cls).resource_cleanup()
@classmethod
@ -122,6 +119,8 @@ class BaseTestCase(base.BaseNetworkTest):
except Exception:
raise Exception(_("Failed to create load balancer..."))
cls._lbs_to_delete.append(lb.get('id'))
port = cls.client.show_port(lb['vip_port_id'])
cls.ports.append(port['port'])
return lb
@classmethod
@ -151,7 +150,7 @@ class BaseTestCase(base.BaseNetworkTest):
provisioning_status='ACTIVE',
operating_status='ONLINE',
delete=False):
interval_time = 10
interval_time = 1
timeout = 600
end_time = time.time() + timeout
lb = {}

View File

@ -321,10 +321,10 @@ class LoadBalancersTestJSON(base.BaseTestCase):
@test.attr(type='smoke')
def test_update_load_balancer_missing_name(self):
"""Test update load balancer with missing name"""
self._update_load_balancer(self.load_balancer_id)
loadbalancer = self.load_balancers_client.get_load_balancer(
self.load_balancer_id)
load_balancer_initial = loadbalancer['name']
self._update_load_balancer(self.load_balancer_id)
load_balancer = self.load_balancers_client.get_load_balancer(
self.load_balancer_id)
load_balancer_new = load_balancer['name']
@ -352,10 +352,10 @@ class LoadBalancersTestJSON(base.BaseTestCase):
@test.attr(type='smoke')
def test_update_load_balancer_missing_description(self):
"""Test update load balancer with missing description"""
self._update_load_balancer(self.load_balancer_id)
loadbalancer = self.load_balancers_client.get_load_balancer(
self.load_balancer_id)
load_balancer_initial = loadbalancer['description']
self._update_load_balancer(self.load_balancer_id)
load_balancer = self.load_balancers_client.get_load_balancer(
self.load_balancer_id)
load_balancer_new = load_balancer['description']
@ -382,10 +382,10 @@ class LoadBalancersTestJSON(base.BaseTestCase):
@test.attr(type='smoke')
def test_update_load_balancer_missing_admin_state_up(self):
"""Test update load balancer with missing admin state field"""
self._update_load_balancer(self.load_balancer_id)
loadbalancer = self.load_balancers_client.get_load_balancer(
self.load_balancer_id)
load_balancer_initial = loadbalancer['admin_state_up']
self._update_load_balancer(self.load_balancer_id)
self.assertEqual(load_balancer_initial, True)
@test.attr(type='negative')

View File

@ -91,7 +91,6 @@ class TestPools(base.BaseTestCase):
self.assertEqual(1, len(pools))
self.assertIn(new_pool, pools)
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_list_pools_two(self):
"""Test get pools with two pools"""
@ -124,7 +123,6 @@ class TestPools(base.BaseTestCase):
tenant_id=tenant_id,
lb_algorithm='ROUND_ROBIN')
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_create_pool_missing_tenant_field(self):
"""Test create pool with a missing required tenant field"""
@ -136,7 +134,6 @@ class TestPools(base.BaseTestCase):
pool_tenant = pool['tenant_id']
self.assertEqual(tenant_id, pool_tenant)
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_create_pool_missing_protocol_field(self):
"""Test create pool with a missing required protocol field"""
@ -153,7 +150,6 @@ class TestPools(base.BaseTestCase):
listener_id=listener_id,
lb_algorithm='ROUND_ROBIN')
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_create_pool_missing_lb_algorithm_field(self):
"""Test create pool with a missing required lb algorithm field"""
@ -179,7 +175,6 @@ class TestPools(base.BaseTestCase):
lb_algorithm='ROUND_ROBIN',
protocol='HTTP')
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_create_pool_missing_description_field(self):
"""Test create pool with missing description field"""
@ -189,31 +184,25 @@ class TestPools(base.BaseTestCase):
desc = pool_initial.get('description')
self.assertEqual(desc, "")
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_create_pool_missing_name_field(self):
"""Test create pool with a missing name field"""
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
new_pool = self._prepare_and_create_pool()
pool_initial = self.pools_client.get_pool(new_pool.get('id'))
name = pool_initial.get('name')
self.assertEqual(name, "")
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_create_pool_missing_admin_state_up_field(self):
"""Test create pool with a missing admin_state_up field"""
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
new_pool = self._prepare_and_create_pool()
pool_initial = self.pools_client.get_pool(new_pool.get('id'))
state = pool_initial.get('admin_state_up')
self.assertEqual(state, True)
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_create_pool_missing_session_pers_field(self):
"""Test create pool with a missing session_pers field"""
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
new_pool = self._prepare_and_create_pool()
pool_initial = self.pools_client.get_pool(new_pool.get('id'))
sess = pool_initial.get('session_persistence')
@ -259,7 +248,6 @@ class TestPools(base.BaseTestCase):
protocol='HTTP',
listener_id="$@5$%$7863")
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_create_pool_invalid_tenant_id_field(self):
"""Test create pool with invalid tenant_id field"""
@ -439,7 +427,6 @@ class TestPools(base.BaseTestCase):
wait=True)
self.assertEqual(desc, pool.get('description'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_update_pool_missing_name(self):
"""Test update pool with missing name"""
@ -450,7 +437,6 @@ class TestPools(base.BaseTestCase):
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(name, pool.get('name'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_update_pool_missing_description(self):
"""Test update pool with missing description"""
@ -461,7 +447,6 @@ class TestPools(base.BaseTestCase):
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(desc, pool.get('description'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_update_pool_missing_admin_state_up(self):
"""Test update pool with missing admin state up field"""
@ -472,7 +457,6 @@ class TestPools(base.BaseTestCase):
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(admin, pool.get('admin_state_up'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_update_pool_missing_session_persistence(self):
"""Test update pool with missing session persistence"""
@ -499,7 +483,6 @@ class TestPools(base.BaseTestCase):
new_pool.get('id'),
description='d' * 256)
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_update_pool_invalid_admin_state_up(self):
"""Test update pool with an invalid admin_state_up"""
@ -507,7 +490,6 @@ class TestPools(base.BaseTestCase):
self.assertRaises(ex.BadRequest, self.pools_client.update_pool,
new_pool.get('id'), admin_state_up='hello')
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_update_pool_invalid_session_persistence(self):
"""Test update pool with an invalid session pers. field"""
@ -516,7 +498,6 @@ class TestPools(base.BaseTestCase):
new_pool.get('id'),
session_persistence={'type': 'Hello'})
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_update_pool_empty_name(self):
"""Test update pool with empty name"""
@ -525,7 +506,6 @@ class TestPools(base.BaseTestCase):
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(pool.get('name'), "")
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_update_pool_empty_description(self):
"""Test update pool with empty description"""
@ -535,7 +515,6 @@ class TestPools(base.BaseTestCase):
self._wait_for_load_balancer_status(self.load_balancer.get('id'))
self.assertEqual(pool.get('description'), "")
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_update_pool_empty_admin_state_up(self):
"""Test update pool with empty admin state up"""
@ -543,7 +522,6 @@ class TestPools(base.BaseTestCase):
self.assertRaises(ex.BadRequest, self.pools_client.update_pool,
new_pool.get('id'), admin_state_up="")
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_update_pool_empty_session_persistence(self):
"""Test update pool with empty session persistence field"""
@ -552,7 +530,6 @@ class TestPools(base.BaseTestCase):
new_pool.get('id'),
session_persistence="")
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_update_pool_invalid_attribute(self):
"""Test update pool with an invalid attribute"""
@ -560,7 +537,6 @@ class TestPools(base.BaseTestCase):
self.assertRaises(ex.BadRequest, self._update_pool,
new_pool.get('id'), lb_algorithm='ROUNDED')
@decorators.skip_because(bug="1497471")
@test.attr(type='negative')
def test_update_pool_incorrect_attribute(self):
"""Test update a pool with an extra, incorrect field"""
@ -578,7 +554,6 @@ class TestPools(base.BaseTestCase):
self.assertRaises(ex.NotFound, self.pools_client.get_pool,
new_pool.get('id'))
@decorators.skip_because(bug="1497471")
@test.attr(type='smoke')
def test_delete_invalid_pool(self):
"""Test delete pool that doesn't exist"""