Merge "make tempest work under py3"

This commit is contained in:
Jenkins 2017-08-13 06:48:13 +00:00 committed by Gerrit Code Review
commit cf8782b453
6 changed files with 28 additions and 26 deletions

View File

@ -29,6 +29,8 @@ DEVSTACK_LOCAL_CONFIG+=$'\nenable_plugin ceilometer git://git.openstack.org/open
DEVSTACK_LOCAL_CONFIG+=$'\nenable_plugin aodh git://git.openstack.org/openstack/aodh'
DEVSTACK_LOCAL_CONFIG+=$'\ndisable_service ceilometer-alarm-evaluator,ceilometer-alarm-notifier'
DEVSTACK_LOCAL_CONFIG+=$'\ndisable_service n-net'
DEVSTACK_LOCAL_CONFIG+=$'\ndisable_service s-account s-container s-object s-proxy'
DEVSTACK_LOCAL_CONFIG+="$(cat <<EOF

View File

@ -13,37 +13,36 @@
# License for the specific language governing permissions and limitations
# under the License.
#sudo chmod -R a+rw /opt/stack/
DEVSTACK_PATH="$BASE/new"
#(cd $DEVSTACK_PATH/tempest/; sudo virtualenv .venv)
#source $DEVSTACK_PATH/tempest/.venv/bin/activate
if [ "$1" = "api" ]; then
TESTS="topology"
elif [ "$1" = "datasources" ]; then
TESTS="datasources\|test_events"
TESTS="datasources|test_events"
else
TESTS="topology"
fi
#(cd $DEVSTACK_PATH/tempest/; sudo pip install -r requirements.txt -r test-requirements.txt)
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf vitrage/vitrage_tempest_tests/tests/resources/static_physical/static_physical_configuration.yaml /etc/vitrage/')
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf vitrage/vitrage_tempest_tests/tests/resources/templates/api/* /etc/vitrage/templates/')
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf vitrage/vitrage_tempest_tests/tests/resources/heat/heat_template.yaml /etc/vitrage/')
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf vitrage/vitrage_tempest_tests/tests/resources/heat/policy.json-tempest /etc/heat/')
cd $DEVSTACK_PATH/
sudo cp -rf vitrage/vitrage_tempest_tests/tests/resources/static_physical/static_physical_configuration.yaml /etc/vitrage/
sudo cp -rf vitrage/vitrage_tempest_tests/tests/resources/templates/api/* /etc/vitrage/templates/
sudo cp -rf vitrage/vitrage_tempest_tests/tests/resources/heat/heat_template.yaml /etc/vitrage/
sudo cp -rf vitrage/vitrage_tempest_tests/tests/resources/heat/policy.json-tempest /etc/heat/
sudo cp $DEVSTACK_PATH/tempest/etc/logging.conf.sample $DEVSTACK_PATH/tempest/etc/logging.conf
#(cd $DEVSTACK_PATH/vitrage/; sudo pip install -r requirements.txt -r test-requirements.txt)
#(cd $DEVSTACK_PATH/vitrage/; sudo python setup.py install)
if [ "$DEVSTACK_GATE_USE_PYTHON3" == "True" ]; then
export PYTHON=python3
fi
cd $DEVSTACK_PATH/tempest/; sudo -E testr init
(cd $BASE/new/tempest/; sudo -E testr init)
env
echo "Listing existing Tempest tests"
(cd $DEVSTACK_PATH/tempest/; sudo sh -c 'testr list-tests vitrage_tempest_tests')
(cd $DEVSTACK_PATH/tempest/; sudo sh -c 'testr list-tests vitrage_tempest_tests | grep -E '$TESTS' > vitrage_tempest_tests.list')
sudo -E testr list-tests vitrage_tempest_tests
sudo -E testr list-tests vitrage_tempest_tests | grep -E "$TESTS" > /tmp/vitrage_tempest_tests.list
echo "Testing $1: $TESTS..."
(cd $DEVSTACK_PATH/tempest/; sudo sh -c 'testr run --subunit --load-list=vitrage_tempest_tests.list | subunit-trace --fails')
sudo -E testr run --subunit --load-list=/tmp/vitrage_tempest_tests.list | subunit-trace --fails

View File

@ -94,7 +94,6 @@ class DriverBase(object):
pass
@staticmethod
@abc.abstractmethod
def get_event_types():
"""Return a list of all event types relevant to this datasource

View File

@ -17,6 +17,7 @@ import traceback
from oslo_log import log as logging
from oslotest import base
from six.moves import filter
from vitrage.common.constants import EdgeProperties
from vitrage.common.constants import EntityCategory
@ -78,7 +79,7 @@ class BaseApiTest(base.BaseTestCase):
count = 0
while count < 40:
LOG.info("wait_for_client - " + client_func.func_name)
LOG.info("wait_for_client - " + client_func.__name__)
client = client_func(conf)
if client:
return client
@ -126,7 +127,7 @@ class BaseApiTest(base.BaseTestCase):
host = filter(
lambda item: item[VProps.VITRAGE_TYPE] == NOVA_HOST_DATASOURCE,
topology['nodes'])
return host[0]
return next(host)
def _create_instances(self, num_instances, set_public_network=False):
kwargs = {}
@ -377,9 +378,10 @@ class BaseApiTest(base.BaseTestCase):
public_nets = filter(
lambda item: self._get_value(item, VProps.NAME) == 'public',
networks['networks'])
if not public_nets:
try:
return next(public_nets)
except StopIteration:
return None
return public_nets[0]
def _print_entity_graph(self):
api_graph = self.vitrage_client.topology.get(all_tenants=True)

View File

@ -67,14 +67,14 @@ class TestStaticPhysical(BaseApiTest):
# template file
file_path = '/etc/vitrage/static_physical_configuration.yaml'
with open(file_path, 'rb') as f:
with open(file_path, 'r') as f:
template_data = f.read()
template_data = template_data.replace('tmp-devstack', hostname)
# new file
new_file = open(
'/etc/vitrage/static_datasources/'
'static_physical_configuration.yaml', 'wb')
'static_physical_configuration.yaml', 'w')
new_file.write(template_data)
new_file.close()

View File

@ -73,7 +73,7 @@ def run_vitrage_command(command, conf):
LOG.error('error from command %(command)s = %(error)s',
{'error': stderr, 'command': full_command})
return stdout
return stdout.decode('utf-8')
def get_property_value(environment_name, conf_name, default_value, conf):
@ -120,7 +120,7 @@ def uni2str(text):
def tempest_logger(func):
func_name = func.func_name
func_name = func.__name__
@wraps(func)
def func_name_print_func(*args, **kwargs):