Merge "use aodhclient in integration test"
diff --git a/ceilometer/tests/integration/hooks/post_test_hook.sh b/ceilometer/tests/integration/hooks/post_test_hook.sh
index 3d8781a..e19cafa 100755
--- a/ceilometer/tests/integration/hooks/post_test_hook.sh
+++ b/ceilometer/tests/integration/hooks/post_test_hook.sh
@@ -14,18 +14,22 @@
 
 # This script is executed inside post_test_hook function in devstack gate.
 
-function generate_testr_results {
+function export_subunit_data {
+    target="$1"
     if [ -f .testrepository/0 ]; then
-        sudo .tox/functional/bin/testr last --subunit > $WORKSPACE/testrepository.subunit
-        sudo mv $WORKSPACE/testrepository.subunit $BASE/logs/testrepository.subunit
-        sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
-        sudo gzip -9 $BASE/logs/testrepository.subunit
-        sudo gzip -9 $BASE/logs/testr_results.html
-        sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
-        sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
+        sudo testr last --subunit > $WORKSPACE/testrepository.subunit.$target
     fi
 }
 
+function generate_testr_results {
+    cat $WORKSPACE/testrepository.subunit.* | sudo tee $BASE/logs/testrepository.subunit
+    sudo /usr/os-testr-env/bin/subunit2html $BASE/logs/testrepository.subunit $BASE/logs/testr_results.html
+    sudo gzip -9 $BASE/logs/testrepository.subunit
+    sudo gzip -9 $BASE/logs/testr_results.html
+    sudo chown jenkins:jenkins $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
+    sudo chmod a+r $BASE/logs/testrepository.subunit.gz $BASE/logs/testr_results.html.gz
+}
+
 # If we're running in the gate find our keystone endpoint to give to
 # gabbi tests and do a chown. Otherwise the existing environment
 # should provide URL and TOKEN.
@@ -57,6 +61,7 @@
     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"
     if [[ $TEMPEST_EXIT_CODE != 0 ]]; then
         # Collect and parse result
         generate_testr_results
@@ -109,6 +114,7 @@
 
 # Collect and parse result
 if [ -n "$CEILOMETER_DIR" ]; then
+    export_subunit_data "integration"
     generate_testr_results
 fi
 exit $EXIT_CODE
diff --git a/ceilometer/tests/tempest/api/base.py b/ceilometer/tests/tempest/api/base.py
index 10eea60..d19e025 100644
--- a/ceilometer/tests/tempest/api/base.py
+++ b/ceilometer/tests/tempest/api/base.py
@@ -143,16 +143,3 @@
     def setup_clients(cls):
         super(BaseTelemetryAdminTest, cls).setup_clients()
         cls.telemetry_admin_client = cls.os_adm.telemetry_client
-
-    def await_events(self, query):
-        timeout = CONF.compute.build_timeout
-        start = timeutils.utcnow()
-        while timeutils.delta_seconds(start, timeutils.utcnow()) < timeout:
-            body = self.telemetry_admin_client.list_events(query)
-            if body:
-                return body
-            time.sleep(CONF.compute.build_interval)
-
-        raise exceptions.TimeoutException(
-            'Event with query:%s has not been added to the '
-            'database within %d seconds' % (query, CONF.compute.build_timeout))
diff --git a/ceilometer/tests/tempest/api/test_telemetry_notification_api.py b/ceilometer/tests/tempest/api/test_telemetry_notification_api.py
index 91271b0..b0809ee 100644
--- a/ceilometer/tests/tempest/api/test_telemetry_notification_api.py
+++ b/ceilometer/tests/tempest/api/test_telemetry_notification_api.py
@@ -16,7 +16,6 @@
 
 from ceilometer.tests.tempest.api import base
 from tempest import config
-from tempest.lib import decorators
 from tempest import test
 
 
@@ -57,15 +56,10 @@
 
     @test.idempotent_id('29604198-8b45-4fc0-8af8-1cae4f94ebea')
     @test.services('compute')
-    @decorators.skip_because(bug='1480490')
     def test_check_nova_notification_event_and_meter(self):
 
         body = self.create_server()
 
-        if CONF.telemetry.event_enabled:
-            query = ('instance_id', 'eq', body['id'])
-            self.await_events(query)
-
         query = ('resource', 'eq', body['id'])
         for metric in self.nova_notifications:
             self.await_samples(metric, query)
diff --git a/ceilometer/tests/tempest/service/client.py b/ceilometer/tests/tempest/service/client.py
index b45cb70..6fe637f 100644
--- a/ceilometer/tests/tempest/service/client.py
+++ b/ceilometer/tests/tempest/service/client.py
@@ -83,10 +83,6 @@
         uri = '%s/meters/%s' % (self.uri_prefix, meter_id)
         return self._helper_list(uri, query)
 
-    def list_events(self, query=None):
-        uri = '%s/events' % self.uri_prefix
-        return self._helper_list(uri, query)
-
     def show_resource(self, resource_id):
         uri = '%s/resources/%s' % (self.uri_prefix, resource_id)
         resp, body = self.get(uri)