Tolerate gnocchiclient import errors

currently we are experiencing errors due to `ujson` dependency
of gnocchiclient (see https://github.com/esnme/ultrajson/issues/346).

For now it seems to affect Py2 only, and is fixed in master of that lib,
but until then let's just tolerate failure to load gnocchiclient
and skip that single scenario test where it is used in case of an error.

Change-Id: Ice4f12d875c940c07e22af9170aaa0b258dd5c06
Related-Issue: PRODX-2479
diff --git a/heat_tempest_plugin/services/clients.py b/heat_tempest_plugin/services/clients.py
index d6e1dfb..c5576e1 100644
--- a/heat_tempest_plugin/services/clients.py
+++ b/heat_tempest_plugin/services/clients.py
@@ -13,7 +13,12 @@
 import os
 
 from cinderclient import client as cinder_client
-from gnocchiclient import client as gnocchi_client
+try:
+    from gnocchiclient import client as gnocchi_client
+except ImportError:
+    # catches ujson vs Python GCC compat problem,
+    # see https://github.com/esnme/ultrajson/issues/346
+    gnocchi_client = None
 from heatclient import client as heat_client
 from keystoneauth1.identity.generic import password
 from keystoneauth1 import session
@@ -183,6 +188,8 @@
         return swift_client.Connection(**args)
 
     def _get_metric_client(self):
+        if gnocchi_client is None:
+            return None
 
         adapter_options = {'interface': self.conf.endpoint_type,
                            'region_name': self.conf.region}
diff --git a/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py b/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
index 4e25158..294f821 100644
--- a/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
+++ b/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
@@ -29,6 +29,11 @@
                                             'test_aodh_alarm.yaml',
                                             'templates')
 
+    def check_skip(self):
+        super(AodhAlarmTest, self).check_skip()
+        if self.metric_client is None:
+            self.skipTest("Gnocchiclient is not available")
+
     def check_instance_count(self, stack_identifier, expected):
         stack = self.client.stacks.get(stack_identifier)
         actual = self._stack_output(stack, 'asg_size')