Merge "integration: deleting the stack sometimes timeout"
diff --git a/ceilometer/tests/integration/hooks/post_test_hook.sh b/ceilometer/tests/integration/hooks/post_test_hook.sh
index aec4501..3663419 100755
--- a/ceilometer/tests/integration/hooks/post_test_hook.sh
+++ b/ceilometer/tests/integration/hooks/post_test_hook.sh
@@ -95,22 +95,6 @@
export GLANCE_IMAGE_NAME=$(openstack image list | awk '/ cirros.*uec /{print $4}')
export ADMIN_TOKEN=$(openstack token issue -c id -f value)
-if [ -d $BASE/new/devstack ]; then
- # NOTE(sileht): on swift job permissions are wrong, I don't known why
- sudo chown -R tempest:stack $BASE/new/tempest
- sudo chown -R tempest:stack $BASE/data/tempest
-
- # Run tests with tempest
- cd $BASE/new/tempest
- set +e
- sudo -H -u tempest OS_TEST_TIMEOUT=$TEMPEST_OS_TEST_TIMEOUT tox -eall-plugin -- ceilometer.tests.tempest.scenario.test_autoscaling --concurrency=$TEMPEST_CONCURRENCY
- TEMPEST_EXIT_CODE=$?
- set -e
- export_subunit_data "all-plugin"
- generate_reports_and_maybe_exit $TEMPEST_EXIT_CODE
- cd $CEILOMETER_DIR
-fi
-
# Run tests with gabbi
echo "Running telemetry integration test suite"
set +e
@@ -120,6 +104,17 @@
if [ -d $BASE/new/devstack ]; then
export_subunit_data "integration"
generate_reports_and_maybe_exit $EXIT_CODE
+
+ # NOTE(sileht): on swift job permissions are wrong, I don't known why
+ sudo chown -R tempest:stack $BASE/new/tempest
+ sudo chown -R tempest:stack $BASE/data/tempest
+
+ # Run tests with tempest
+ cd $BASE/new/tempest
+ sudo -H -u tempest OS_TEST_TIMEOUT=$TEMPEST_OS_TEST_TIMEOUT tox -eall-plugin -- ceilometer.tests.tempest.scenario.test_autoscaling --concurrency=$TEMPEST_CONCURRENCY
+ EXIT_CODE=$?
+ export_subunit_data "all-plugin"
+ generate_reports_and_maybe_exit $EXIT_CODE
fi
exit $EXIT_CODE
diff --git a/ceilometer/tests/tempest/scenario/test_autoscaling.py b/ceilometer/tests/tempest/scenario/test_autoscaling.py
index f609363..3b0217b 100644
--- a/ceilometer/tests/tempest/scenario/test_autoscaling.py
+++ b/ceilometer/tests/tempest/scenario/test_autoscaling.py
@@ -92,15 +92,35 @@
def _get_endpoint_for(auth, service):
opt_section = getattr(config.CONF, service)
endpoint_type = opt_section.endpoint_type
- if not endpoint_type.endswith("URL"):
- endpoint_type += "URL"
+ is_keystone_v3 = 'catalog' in auth[1]
- endpoints = [e for e in auth[1]['serviceCatalog']
- if e['type'] == opt_section.catalog_type]
- if not endpoints:
- raise Exception("%s endpoint not found" %
- config.CONF.metric.catalog_type)
- return endpoints[0]['endpoints'][0][endpoint_type]
+ if is_keystone_v3:
+ if endpoint_type.endswith("URL"):
+ endpoint_type = endpoint_type[:-3]
+ catalog = auth[1]['catalog']
+ endpoints = [e['endpoints'] for e in catalog
+ if e['type'] == opt_section.catalog_type]
+ if not endpoints:
+ raise Exception("%s endpoint not found" %
+ config.CONF.metric.catalog_type)
+ endpoints = [e['url'] for e in endpoints[0]
+ if e['interface'] == endpoint_type]
+ if not endpoints:
+ raise Exception("%s interface not found for endpoint %s" %
+ (endpoint_type,
+ config.CONF.metric.catalog_type))
+ return endpoints[0]
+
+ else:
+ if not endpoint_type.endswith("URL"):
+ endpoint_type += "URL"
+ catalog = auth[1]['serviceCatalog']
+ endpoints = [e for e in catalog
+ if e['type'] == opt_section.catalog_type]
+ if not endpoints:
+ raise Exception("%s endpoint not found" %
+ config.CONF.metric.catalog_type)
+ return endpoints[0]['endpoints'][0][endpoint_type]
@staticmethod
def test_fake():