Merge "Fix heat service availability config option name"
diff --git a/heat_tempest_plugin/tests/scenario/templates/remote_nested_base.yaml b/heat_tempest_plugin/tests/scenario/templates/remote_nested_base.yaml
new file mode 100644
index 0000000..fc1441f
--- /dev/null
+++ b/heat_tempest_plugin/tests/scenario/templates/remote_nested_base.yaml
@@ -0,0 +1,29 @@
+heat_template_version: 2015-10-15
+description: |
+  The base stack (containing an actual resource) for the remote deeply-nested
+  stack test.
+
+parameters:
+  name:
+    type: string
+    description: Name of the router
+    constraints:
+      - allowed_pattern: "[a-z][a-z0-9-]{1,}"
+  network_name:
+    type: string
+    description: The network to connect to
+    constraints:
+      - custom_constraint: neutron.network
+
+resources:
+  router:
+    type: OS::Neutron::Router
+    properties:
+      name:
+        list_join: ['-', [{ get_param: name }, 'router']]
+      external_gateway_info:
+        network: {get_param: network_name}
+
+outputs:
+  router:
+    value: {get_resource: router}
diff --git a/heat_tempest_plugin/tests/scenario/templates/remote_nested_intermediate.yaml b/heat_tempest_plugin/tests/scenario/templates/remote_nested_intermediate.yaml
new file mode 100644
index 0000000..6fc7082
--- /dev/null
+++ b/heat_tempest_plugin/tests/scenario/templates/remote_nested_intermediate.yaml
@@ -0,0 +1,27 @@
+heat_template_version: 2015-10-15
+description: |
+  The intermediate stack (containing a local nested stack) to be instantiated
+  remotely in the remote deeply-nested stack test.
+
+parameters:
+  name:
+    type: string
+    description: Name of the router
+    constraints:
+      - allowed_pattern: "[a-z][a-z0-9-]{1,}"
+  network_name:
+    type: string
+    description: The public network to connect to
+    constraints:
+      - custom_constraint: neutron.network
+
+resources:
+  network_stack_as_custom_type:
+    type: remote_nested_base.yaml
+    properties:
+      name: {get_param: name}
+      network_name: {get_param: network_name}
+
+outputs:
+  router:
+    value: {get_attr: [network_stack_as_custom_type, router]}
diff --git a/heat_tempest_plugin/tests/scenario/templates/remote_nested_root.yaml b/heat_tempest_plugin/tests/scenario/templates/remote_nested_root.yaml
new file mode 100644
index 0000000..39bb8cb
--- /dev/null
+++ b/heat_tempest_plugin/tests/scenario/templates/remote_nested_root.yaml
@@ -0,0 +1,35 @@
+heat_template_version: 2015-10-15
+description: |
+  The root stack (containing a remote stack) for the deeply-nested remote
+  stack test.
+
+parameters:
+  name:
+    type: string
+    description: Name of the router
+    constraints:
+      - allowed_pattern: "[a-z][a-z0-9-]{1,}"
+  network_name:
+    type: string
+    description: The public network to connect to
+    constraints:
+      - custom_constraint: neutron.network
+  region:
+    type: string
+    description: The region in which to create the remote stack
+    default: RegionOne
+
+resources:
+  network_stack:
+    type: OS::Heat::Stack
+    properties:
+      template: {get_file: remote_nested_intermediate.yaml}
+      context:
+        region_name: {get_param: region}
+      parameters:
+        name: {get_param: name}
+        network_name: {get_param: network_name}
+
+outputs:
+  router:
+    value: {get_attr: [network_stack, outputs, router]}
diff --git a/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py b/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
index 4e25158..dafca12 100644
--- a/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
+++ b/heat_tempest_plugin/tests/scenario/test_aodh_alarm.py
@@ -51,9 +51,9 @@
         stack_identifier = self.stack_create(template=self.template,
                                              parameters=parameters)
 
-        measures = [{'timestamp': test.isotime(datetime.datetime.now()),
+        measures = [{'timestamp': test.isotime(datetime.datetime.utcnow()),
                      'value': 100}, {'timestamp': test.isotime(
-                         datetime.datetime.now() + datetime.timedelta(
+                         datetime.datetime.utcnow() + datetime.timedelta(
                              minutes=1)), 'value': 100}]
         # send measures(should cause the alarm to fire)
         self.metric_client.metric.add_measures(metric['id'], measures)
diff --git a/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py b/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py
new file mode 100644
index 0000000..d020e63
--- /dev/null
+++ b/heat_tempest_plugin/tests/scenario/test_remote_deeply_nested.py
@@ -0,0 +1,39 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import six
+import uuid
+
+from heat_tempest_plugin.tests.scenario import scenario_base
+from tempest.lib import decorators
+
+
+class RemoteDeeplyNestedStackTest(scenario_base.ScenarioTestsBase):
+    @decorators.idempotent_id('2ed94cae-da14-4060-a6b3-526e7a8cbbe4')
+    def test_remote_nested(self):
+        parameters = {
+            'name': 'remote-nested',
+            'network_name': 'public',
+        }
+
+        stack_id = self.launch_stack(
+            template_name='remote_nested_root.yaml',
+            parameters={'region': self.conf.region},
+            environment={'parameters': parameters}
+        )
+
+        stack = self.client.stacks.get(stack_id)
+        router_id = self._stack_output(stack, 'router')
+        self.assertIsInstance(router_id, six.string_types)
+        uuid.UUID(router_id)
+
+        self._stack_delete(stack_id)
diff --git a/tox.ini b/tox.ini
index 7b8aeec..549457a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -12,6 +12,7 @@
            testr run {posargs}
 
 [testenv:pep8]
+basepython = python3
 setenv =
     PYTHONPATH = .
 commands =
@@ -25,12 +26,14 @@
     check-uuid --fix --package heat_tempest_plugin
 
 [testenv:docs]
+basepython = python3
 deps = -r{toxinidir}/requirements.txt
        -r{toxinidir}/test-requirements.txt
        sphinxcontrib-httpdomain
 commands = python setup.py build_sphinx
 
 [testenv:venv]
+basepython = python3
 commands = {posargs}
 
 [flake8]