tempest: Allow to configure granularity

Change-Id: I31344a9f8938ae9c7875cad76430508dd9fd4539
diff --git a/ceilometer/tests/integration/gabbi/gabbits-live/create_stack.json b/ceilometer/tests/integration/gabbi/gabbits-live/create_stack.json
index 91f7daf..57a6366 100644
--- a/ceilometer/tests/integration/gabbi/gabbits-live/create_stack.json
+++ b/ceilometer/tests/integration/gabbi/gabbits-live/create_stack.json
@@ -44,7 +44,7 @@
                     "description": "Scale-up if the mean CPU > 10% on 1 minute",
                     "metric": "cpu_util",
                     "aggregation_method": "mean",
-                    "granularity": 60,
+                    "granularity": $ENVIRON["AODH_GRANULARITY"],
                     "evaluation_periods": 1,
                     "threshold": 10,
                     "comparison_operator": "gt",
diff --git a/ceilometer/tests/integration/gabbi/gabbits-live/update_stack.json b/ceilometer/tests/integration/gabbi/gabbits-live/update_stack.json
index de0fce6..54f8e29 100644
--- a/ceilometer/tests/integration/gabbi/gabbits-live/update_stack.json
+++ b/ceilometer/tests/integration/gabbi/gabbits-live/update_stack.json
@@ -43,7 +43,7 @@
                     "description": "Scale-down if the mean CPU > 10% on 1 minute",
                     "metric": "cpu_util",
                     "aggregation_method": "mean",
-                    "granularity": 60,
+                    "granularity": $ENVIRON["AODH_GRANULARITY"],
                     "evaluation_periods": 1,
                     "threshold": 10,
                     "comparison_operator": "gt",
diff --git a/ceilometer/tests/tempest/config.py b/ceilometer/tests/tempest/config.py
index 4125a7f..0df195b 100644
--- a/ceilometer/tests/tempest/config.py
+++ b/ceilometer/tests/tempest/config.py
@@ -47,4 +47,9 @@
                default=1,
                help="The seconds to sleep after an unsuccessful "
                     "notification received."),
+    cfg.IntOpt('alarm_granularity',
+               default=300,
+               help="Granularity to use for aodh alarms. This must match the "
+                    "configured Gnocchi archive policy")
+
 ]
diff --git a/ceilometer/tests/tempest/scenario/test_telemetry_integration.py b/ceilometer/tests/tempest/scenario/test_telemetry_integration.py
index d2dec4b..fecebae 100644
--- a/ceilometer/tests/tempest/scenario/test_telemetry_integration.py
+++ b/ceilometer/tests/tempest/scenario/test_telemetry_integration.py
@@ -83,6 +83,7 @@
 
         os.environ.update({
             "ADMIN_TOKEN": auth[0],
+            "AODH_GRANULARITY": str(config.CONF.telemetry.alarm_granularity),
             "AODH_SERVICE_URL": self._get_endpoint(auth, "alarming_plugin"),
             "GNOCCHI_SERVICE_URL": self._get_endpoint(auth, "metric"),
             "PANKO_SERVICE_URL": self._get_endpoint(auth, "event"),