Add repeatable single ostf tests

To get possibility execute single ostf test
n times new test was added:
* deploy simple nova vlan, by default execute 50
  times test for verification public connectivity
  by floating ip
* deploy simple nova flat, by default execute 50
  times test for verification public connectivity
  by floating ip

Also there is possibility to change count of execution
and tests that should be invoked by environment
variables

Change-Id: Id7b09ccf7c398262f7ec3ebcbd222f349be95fc6
This commit is contained in:
TatyanaLeontovich 2014-02-24 22:07:45 +02:00 committed by NastyaUrlapova
parent 7fbe99c86a
commit 374af88198
6 changed files with 323 additions and 5 deletions

View File

@ -442,13 +442,25 @@ class FuelWebClient(object):
failed_test_name=failed_test_name)
@logwrap
def run_single_ostf_test(self, cluster_id,
test_sets=None, test_name=None, should_fail=0):
def return_ostf_results(self, cluster_id, timeout):
set_result_list = self._ostf_test_wait(cluster_id, timeout)
tests_res = []
for set_result in set_result_list:
[tests_res.append({test['name']:test['status']})
for test in set_result['tests'] if test['status'] != 'disabled']
logger.info('OSTF test statuses are : {0}'.format(tests_res))
return tests_res
@logwrap
def run_single_ostf_test(self, cluster_id,
test_sets=None, test_name=None, should_fail=0,
retries=None):
self.client.ostf_run_singe_test(cluster_id, test_sets, test_name)
self.assert_ostf_run(
cluster_id,
should_fail=should_fail)
if retries:
return self.return_ostf_results(cluster_id, timeout=15 * 60)
else:
self.assert_ostf_run(cluster_id, should_fail=should_fail)
@logwrap
def task_wait(self, task, timeout, interval=5):

View File

@ -0,0 +1,130 @@
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
OSTF_TEST_MAPPING = {
'Check data replication over mysql': 'fuel_health.tests.ha.test_'
'mysql_replication.'
'TestMysqlReplication.'
'test_mysql_replication',
'Check amount of tables in '
'databases is the same on each node': 'fuel_health.tests.ha.'
'test_mysql_replication.'
'TestMysqlReplication.'
'test_os_databases',
'Check mysql environment state': 'fuel_health.tests.ha.'
'test_mysql_replication.'
'TestMysqlReplication.'
'test_state_of_mysql_cluster',
'Check galera environment state': 'fuel_health.tests.ha.'
'test_mysql_replication.'
'TestMysqlReplication.'
'test_state_of_galera_cluster',
'Check RabbitMQ is available': 'fuel_health.tests.ha.'
'test_rabbit.RabbitSmokeTest.'
'test_001_rabbitmqctl_status',
'RabbitMQ availability': 'fuel_health.tests.ha.test_rabbit.'
'RabbitSmokeTest.'
'test_002_rabbitmqctl_status_ubuntu',
'List ceilometer availability': 'fuel_health.tests.sanity.'
'test_sanity_ceilometer.'
'CeilometerApiTests.test_list_meters',
'Request instance list': 'fuel_health.tests.sanity.test_sanity_compute.'
'SanityComputeTest.test_list_instances',
'Request image list': 'fuel_health.tests.sanity.test_sanity_compute.'
'SanityComputeTest.test_list_images',
'Request volume list': 'fuel_health.tests.sanity.test_sanity_compute.'
'SanityComputeTest.test_list_volumes',
'Request snapshot list': 'fuel_health.tests.sanity.test_sanity_compute.'
'SanityComputeTest.test_list_snapshots',
'Request flavor list': 'fuel_health.tests.sanity.test_sanity_compute.'
'SanityComputeTest.test_list_flavors',
'Request absolute limits list': 'fuel_health.tests.sanity.'
'test_sanity_compute.SanityComputeTest.'
'test_list_rate_limits',
'Request stack list': 'fuel_health.tests.sanity.test_sanity_heat.'
'SanityHeatTest.test_list_stacks',
'Request active services list': 'fuel_health.tests.sanity.'
'test_sanity_identity.'
'SanityIdentityTest.test_list_services',
'Request user list': 'fuel_health.tests.sanity.test_sanity_identity.'
'SanityIdentityTest.test_list_users',
'Check that required services are running': 'fuel_health.tests.sanity.'
'test_sanity_infrasructure.'
'SanityInfrastructureTest.'
'test_001_services_state',
'Check internet connectivity from a compute': 'fuel_health.tests.sanity.'
'test_sanity_infrasructure.'
'SanityInfrastructureTest.'
'test_002_internet_'
'connectivity_from_compute',
'Check DNS resolution on compute node': 'fuel_health.tests.sanity.'
'test_sanity_infrasructure.'
'SanityInfrastructureTest.'
'test_003_dns_resolution',
'Create and delete Murano environment': 'fuel_health.tests.sanity.'
'test_sanity_murano.'
'MuranoSanityTests.'
'test_create_and_delete_service',
'Request list of networks': 'fuel_health.tests.sanity.'
'test_sanity_networking.NetworksTest.'
'test_list_networks',
'Savanna tests to create/list/delete node'
' group and cluster templates': 'fuel_health.tests.sanity.'
'test_sanity_savanna.'
'SanitySavannaTests.test_sanity_savanna',
'Create instance flavor': 'fuel_health.tests.smoke.test_create_flavor.'
'FlavorsAdminTest.test_create_flavor',
'Create volume and attach it to instance': 'fuel_health.tests.smoke.'
'test_create_volume.'
'VolumesTest.'
'test_volume_create',
'Create keypair': 'fuel_health.tests.smoke.'
'test_nova_create_instance_with_connectivity.'
'TestNovaNetwork.test_001_create_keypairs',
'Create security group': 'fuel_health.tests.smoke.'
'test_nova_create_instance_with_connectivity.'
'TestNovaNetwork.'
'test_002_create_security_groups',
'Check network parameters': 'fuel_health.tests.smoke.'
'test_nova_create_instance_with_connectivity.'
'TestNovaNetwork.test_003_check_networks',
'Launch instance': 'fuel_health.tests.smoke.'
'test_nova_create_instance_with_connectivity.'
'TestNovaNetwork.test_004_create_servers',
'Check that VM is accessible '
'via floating IP address': 'fuel_health.tests.smoke.'
'test_nova_create_instance_with_connectivity.'
'TestNovaNetwork.'
'test_005_check_public_network_connectivity',
'Check network connectivity'
' from instance via floating IP': 'fuel_health.tests.smoke.'
'test_nova_create_instance_with_'
'connectivity.TestNovaNetwork.'
'test_008_check_public_instance_'
'connectivity_from_instance',
'Check network connectivity from '
'instance without floating IP': 'fuel_health.tests.smoke.test_nova_create_'
'instance_with_connectivity.'
'TestNovaNetwork.test_006_check_'
'internet_connectivity_instance_'
'without_floatingIP',
'Launch instance, create snapshot,'
' launch instance from snapshot': 'fuel_health.tests.smoke.'
'test_nova_image_actions.'
'TestImageAction.test_snapshot',
'Create user and authenticate with it to Horizon': 'fuel_health.tests.'
'smoke.test_'
'user_create.TestUserTe'
'nantRole.test_'
'create_user', }

View File

@ -36,3 +36,10 @@ Murano image available only internally.
4. Murano tests without Internet connection on the instances will be failed
5. For Murano tests execute 'export SLAVE_NODE_MEMORY=5120' before tests run.
6. To get heat autoscale tests passed put image F17-x86_64-cfntools.qcow2 in /tmp before start
================ Run single OSTF tests several times ========================
1. Export environment variable OSTF_TEST_NAME. Example: export OSTF_TEST_NAME='Request list of networks'
2. Export environment variable OSTF_TEST_RETRIES_COUNT. Example: export OSTF_TEST_RETRIES_COUNT=120
3. Execute test_ostf_repetable_tests from tests_strength package
sh "utils/jenkins/system_tests.sh" -t test -w $(pwd) -j "fuelweb_test" -i "$ISO_PATH" -V $(pwd)/venv/fuelweb_test -o --group=create_delete_ip_n_times_nova_flat

View File

@ -11,6 +11,7 @@ def run_tests():
from tests import test_simple # noqa
from tests.tests_strength import test_failover # noqa
from tests.tests_strength import test_master_node_failover # noqa
from tests.tests_strength import test_ostf_repeatable_tests # noqa
from tests.tests_strength import test_restart # noqa
from tests.tests_strength import test_huge_environments # noqa
from tests import test_bonding # noqa

View File

@ -185,3 +185,8 @@ DEFAULT_IMAGES_UBUNTU = os.environ.get(
'/var/lib/libvirt/images/ubuntu-12.04.1-server-amd64-p2.qcow2')
OS_IMAGE = os.environ.get('OS_IMAGE', DEFAULT_IMAGES_CENTOS)
OSTF_TEST_NAME = os.environ.get('OSTF_TEST_NAME',
'Check network connectivity'
' from instance via floating IP')
OSTF_TEST_RETRIES_COUNT = os.environ.get('OSTF_TEST_RETRIES_COUNT', 50)

View File

@ -0,0 +1,163 @@
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import logging
from proboscis import asserts
from proboscis import test
from fuelweb_test.helpers.decorators import debug
from fuelweb_test.helpers.decorators import log_snapshot_on_error
from fuelweb_test import ostf_test_mapping as map_ostf
from fuelweb_test import settings as hlp_date
from fuelweb_test.tests import base_test_case
logger = logging.getLogger(__name__)
logwrap = debug(logger)
@test(groups=["thread_5"])
class OstfRepeatableTests(base_test_case.TestBasic):
@test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_3],
groups=["create_delete_ip_n_times_nova_vlan"])
@log_snapshot_on_error
def create_delete_ip_n_times_nova_vlan(self):
"""Deploy cluster in simple mode with VLAN Manager
Scenario:
1. Create cluster
2. Add 1 nodes with controller roles
3. Add 2 nodes with compute roles
4. Set up cluster to use Network VLAN manager with 8 networks
5. Deploy the cluster
6. Run network verification
7. Run test Check network connectivity
from instance via floating IP' n times
Snapshot create_delete_ip_n_times_nova_vlan
"""
self.env.revert_snapshot("ready_with_3_slaves")
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_date.DEPLOYMENT_MODE_SIMPLE
)
self.fuel_web.update_nodes(
cluster_id,
{
'slave-01': ['controller'],
'slave-02': ['compute']
}
)
self.fuel_web.update_vlan_network_fixed(
cluster_id, amount=8, network_size=32)
self.fuel_web.deploy_cluster_wait(cluster_id)
self.fuel_web.verify_network(cluster_id)
res = []
passed_count = []
failed_count = []
d_key = hlp_date.OSTF_TEST_NAME
test_path = map_ostf.OSTF_TEST_MAPPING.get(hlp_date.OSTF_TEST_NAME)
for i in range(0, hlp_date.OSTF_TEST_RETRIES_COUNT):
result = self.fuel_web.run_single_ostf_test(
cluster_id=cluster_id, test_sets=['smoke', 'sanity'],
test_name=test_path,
retries=True)
res.append(result)
logger.info('res is {0}'.format(res))
for element in res:
[passed_count.append(test)
for test in element if test[d_key] == 'success']
[failed_count.append(test)
for test in element if test[d_key] == 'failure']
[failed_count.append(test)
for test in element if test[d_key] == 'error']
asserts.assert_true(
len(passed_count) == hlp_date.OSTF_TEST_RETRIES_COUNT,
'not all retries were successful, '
'fail {0} retries'.format(len(failed_count)))
self.env.make_snapshot("create_delete_ip_n_times_nova_vlan")
@test(depends_on=[base_test_case.SetupEnvironment.prepare_slaves_3],
groups=["create_delete_ip_n_times_nova_flat"])
@log_snapshot_on_error
def deploy_create_delete_ip_n_times_nova_flat(self):
"""Deploy cluster in simple mode with flat nova-network
Scenario:
1. Create cluster
2. Add 1 node with controller role
3. Add 1 node with compute role
4. Deploy the cluster
5. Verify networks
6. Run test Check network connectivity
from instance via floating IP' n times
Snapshot: create_delete_ip_n_times_nova_flat
"""
self.env.revert_snapshot("ready_with_3_slaves")
cluster_id = self.fuel_web.create_cluster(
name=self.__class__.__name__,
mode=hlp_date.DEPLOYMENT_MODE_SIMPLE
)
self.fuel_web.update_nodes(
cluster_id,
{
'slave-01': ['controller'],
'slave-02': ['compute']
}
)
self.fuel_web.deploy_cluster_wait(cluster_id)
task = self.fuel_web.run_network_verify(cluster_id)
self.fuel_web.assert_task_success(task, 60 * 2, interval=10)
res = []
d_key = hlp_date.OSTF_TEST_NAME
passed_count = []
failed_count = []
test_path = map_ostf.OSTF_TEST_MAPPING.get(hlp_date.OSTF_TEST_NAME)
logger.info('Test path is {0}'.format(test_path))
for i in range(0, hlp_date.OSTF_TEST_RETRIES_COUNT):
result = self.fuel_web.run_single_ostf_test(
cluster_id=cluster_id, test_sets=['smoke', 'sanity'],
test_name=test_path,
retries=True)
res.append(result)
logger.info('res is {0}'.format(res))
logger.info('full res is {0}'.format(res))
for element in res:
[passed_count.append(test)
for test in element if test[d_key] == 'success']
[failed_count.append(test)
for test in element if test[d_key] == 'failure']
[failed_count.append(test)
for test in element if test[d_key] == 'error']
asserts.assert_true(
len(passed_count) == hlp_date.OSTF_TEST_RETRIES_COUNT,
'not all retries were successful,'
' fail {0} retries'.format(len(failed_count)))
self.env.make_snapshot("create_delete_ip_n_times_nova_flat")