Merge "Fix aodh service name check in tempest tests"
diff --git a/doc/source/contributing.rst b/doc/source/contributing.rst
index 2aa0707..1728a61 100644
--- a/doc/source/contributing.rst
+++ b/doc/source/contributing.rst
@@ -1,4 +1,4 @@
 ============
 Contributing
 ============
-.. include:: ../../../CONTRIBUTING.rst
+.. include:: ../../CONTRIBUTING.rst
diff --git a/doc/source/index.rst b/doc/source/index.rst
index cc2c1aa..657cd89 100644
--- a/doc/source/index.rst
+++ b/doc/source/index.rst
@@ -14,7 +14,7 @@
 
    readme
    installation
-   contributor
+   contributing
 
 Indices and tables
 ==================
diff --git a/telemetry_tempest_plugin/integration/hooks/post_test_hook.sh b/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post_test_hook.sh
similarity index 88%
rename from telemetry_tempest_plugin/integration/hooks/post_test_hook.sh
rename to playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post_test_hook.sh
index d212596..a8a4801 100755
--- a/telemetry_tempest_plugin/integration/hooks/post_test_hook.sh
+++ b/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/post_test_hook.sh
@@ -46,11 +46,11 @@
     echo "* Event list:"
     ceilometer event-list -q 'event_type=string::compute.instance.create.end'
     echo "* Nova instance list:"
-    openstack server list
+    openstack server list --all-projects
 
     echo "* Gnocchi instance list:"
     gnocchi resource list -t instance
-    for instance_id in $(openstack server list -f value -c ID); do
+    for instance_id in $(openstack server list -f value -c ID --all-projects); do
         echo "* Nova instance detail:"
         openstack server show $instance_id
         echo "* Gnocchi instance detail:"
@@ -83,6 +83,9 @@
 sudo chown -R tempest:stack $BASE/new/tempest
 sudo chown -R tempest:stack $BASE/data/tempest
 cd $BASE/new/tempest
+sudo -H -u tempest tox -evenv-tempest -- pip install /opt/stack/new/heat-tempest-plugin /opt/stack/new/telemetry-tempest-plugin
+echo "Checking installed Tempest plugins:"
+sudo -H -u tempest tox -evenv-tempest -- tempest list-plugins
 set +e
 sudo -H -u tempest OS_TEST_TIMEOUT=$TEMPEST_OS_TEST_TIMEOUT tox -evenv-tempest -- tempest run -r telemetry_tempest_plugin --concurrency=$TEMPEST_CONCURRENCY
 EXIT_CODE=$?
diff --git a/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/run.yaml b/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/run.yaml
index f11ce27..27d919f 100644
--- a/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/run.yaml
+++ b/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/run.yaml
@@ -40,12 +40,12 @@
           export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin ceilometer git://git.openstack.org/openstack/ceilometer"
           export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin aodh git://git.openstack.org/openstack/aodh"
           export DEVSTACK_LOCAL_CONFIG+=$'\n'"enable_plugin heat git://git.openstack.org/openstack/heat"
-          export DEVSTACK_LOCAL_CONFIG+=$'\n'"TEMPEST_PLUGINS+=' /opt/stack/new/heat-tempest-plugin /opt/stack/new/telemetry-tempest-plugin'"
+          export DEVSTACK_LOCAL_CONFIG+=$'\n'"INSTALL_TEMPEST='False'"
           export DEVSTACK_LOCAL_CONFIG+=$'\n'"CEILOMETER_BACKEND=gnocchi"
           export DEVSTACK_LOCAL_CONFIG+=$'\n'"GNOCCHI_ARCHIVE_POLICY=high"
           export DEVSTACK_LOCAL_CONFIG+=$'\n'"CEILOMETER_PIPELINE_INTERVAL=15"
           function post_test_hook {
-              cd /opt/stack/new/telemetry-tempest-plugin/telemetry_tempest_plugin/integration/hooks/
+              cd /opt/stack/new/telemetry-tempest-plugin/playbooks/legacy/telemetry-dsvm-integration-tempest-plugin/
               ./post_test_hook.sh
           }
           export -f post_test_hook
diff --git a/telemetry_tempest_plugin/gnocchi/__init_.py b/telemetry_tempest_plugin/gnocchi/__init__.py
similarity index 100%
rename from telemetry_tempest_plugin/gnocchi/__init_.py
rename to telemetry_tempest_plugin/gnocchi/__init__.py
diff --git a/telemetry_tempest_plugin/gnocchi/scenario/__init__.py b/telemetry_tempest_plugin/gnocchi/scenario/__init__.py
index 3ad1239..32dc694 100644
--- a/telemetry_tempest_plugin/gnocchi/scenario/__init__.py
+++ b/telemetry_tempest_plugin/gnocchi/scenario/__init__.py
@@ -25,7 +25,7 @@
 CONF = config.CONF
 
 TEST_DIR = os.path.join(os.path.dirname(__file__), '..',
-                        'gnocchi', 'functional_live', 'gabbits')
+                        'functional_live', 'gabbits')
 
 
 class GnocchiGabbiTest(tempest.test.BaseTestCase):
@@ -43,7 +43,8 @@
         token = self.os_admin.auth_provider.get_token()
         url = self.os_admin.auth_provider.base_url(
             {'service': CONF.metric.catalog_type,
-             'endpoint_type': CONF.metric.endpoint_type})
+             'endpoint_type': CONF.metric.endpoint_type,
+             'region': CONF.identity.region})
 
         parsed_url = urlparse.urlsplit(url)
         prefix = parsed_url.path.rstrip('/')  # turn it into a prefix
diff --git a/telemetry_tempest_plugin/integration/gabbi/gabbits-live/aodh-gnocchi-threshold-alarm.yaml b/telemetry_tempest_plugin/integration/gabbi/gabbits-live/aodh-gnocchi-threshold-alarm.yaml
index 65b00e9..9349295 100644
--- a/telemetry_tempest_plugin/integration/gabbi/gabbits-live/aodh-gnocchi-threshold-alarm.yaml
+++ b/telemetry_tempest_plugin/integration/gabbi/gabbits-live/aodh-gnocchi-threshold-alarm.yaml
@@ -218,6 +218,15 @@
       response_strings:
           - "ok"
 
+    - name: get alarm state for 'gabbi-gnocchi-threshold-resource-alarm'
+      desc: get state for alarm
+      GET: $URL
+      request_headers:
+          content-type: application/json
+      status: 200
+      response_strings:
+          - "ok"
+
     - name: search 'gabbi-gnocchi-threshold-resource-alarm' alarm exist
       desc: search for alarm using user_id, project_id, alarm_name
       GET: $ENVIRON['AODH_SERVICE_URL']/v2/alarms
@@ -252,15 +261,6 @@
           $.gnocchi_resources_threshold_rule.resource_type: "ceph_account"
           $.user_id: c8ecb587-d38c-426f-a58d-22b8d4a9a1d3
 
-    - name: get alarm state for 'gabbi-gnocchi-threshold-resource-alarm'
-      desc: get state for alarm
-      GET: $ENVIRON['AODH_SERVICE_URL']/v2/alarms/$RESPONSE['$.alarm_id']/state
-      request_headers:
-          content-type: application/json
-      status: 200
-      response_strings:
-          - "ok"
-
     #
     # Teardown
     #
diff --git a/telemetry_tempest_plugin/scenario/test_telemetry_integration.py b/telemetry_tempest_plugin/scenario/test_telemetry_integration.py
index 53a2a7f..df527c0 100644
--- a/telemetry_tempest_plugin/scenario/test_telemetry_integration.py
+++ b/telemetry_tempest_plugin/scenario/test_telemetry_integration.py
@@ -102,7 +102,7 @@
                 test_base_name="gabbi",
                 suite_dict=utils.load_yaml(f),
                 test_directory=TEST_DIR,
-                host=None, port=None,
+                host="example.com", port=None,
                 fixture_module=None,
                 intercept=None,
                 handlers=runner.initialize_handlers([]),
diff --git a/tox.ini b/tox.ini
index 77f1cb8..55829e0 100644
--- a/tox.ini
+++ b/tox.ini
@@ -16,12 +16,15 @@
 commands = stestr run {posargs}
 
 [testenv:pep8]
+basepython = python3
 commands = flake8 {posargs}
 
 [testenv:venv]
+basepython = python3
 commands = {posargs}
 
 [testenv:cover]
+basepython = python3
 setenv =
     VIRTUAL_ENV={envdir}
     PYTHON=coverage run --source telemetry_tempest_plugin --parallel-mode
@@ -32,13 +35,16 @@
     coverage xml -o cover/coverage.xml
 
 [testenv:docs]
+basepython = python3
 commands = python setup.py build_sphinx
 
 [testenv:releasenotes]
+basepython = python3
 commands =
   sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
 
 [testenv:debug]
+basepython = python3
 commands = oslo_debug_helper {posargs}
 
 [flake8]