Merge "Adds default policy rule for resources limited to administrator"
diff --git a/common/clients.py b/common/clients.py
index 8913595..7a674bf 100644
--- a/common/clients.py
+++ b/common/clients.py
@@ -16,9 +16,9 @@
from cinderclient import client as cinder_client
from heat.common.i18n import _
from heatclient import client as heat_client
-from keystoneclient.auth.identity.generic import password
-from keystoneclient import exceptions as kc_exceptions
-from keystoneclient import session
+from keystoneauth1 import exceptions as kc_exceptions
+from keystoneauth1.identity.generic import password
+from keystoneauth1 import session
from neutronclient.v2_0 import client as neutron_client
from novaclient import client as nova_client
from swiftclient import client as swift_client
@@ -51,10 +51,7 @@
def get_endpoint_url(self, service_type, region=None):
kwargs = {
'service_type': service_type,
- 'endpoint_type': 'publicURL'}
- if region:
- kwargs.update({'attr': 'region',
- 'filter_value': region})
+ 'region_name': region}
return self.auth_ref.service_catalog.url_for(**kwargs)
diff --git a/common/test.py b/common/test.py
index 42fa43c..16d5920 100644
--- a/common/test.py
+++ b/common/test.py
@@ -377,7 +377,6 @@
env = environment or {}
env_files = files or {}
parameters = parameters or {}
- stack_name = stack_identifier.split('/')[0]
self.updated_time[stack_identifier] = self.client.stacks.get(
stack_identifier, resolve_outputs=False).updated_time
@@ -385,7 +384,6 @@
self._handle_in_progress(
self.client.stacks.update,
stack_id=stack_identifier,
- stack_name=stack_name,
template=template,
files=env_files,
disable_rollback=disable_rollback,
@@ -410,11 +408,9 @@
env = environment or {}
env_files = files or {}
parameters = parameters or {}
- stack_name = stack_identifier.split('/')[0]
return self.client.stacks.preview_update(
stack_id=stack_identifier,
- stack_name=stack_name,
template=template,
files=env_files,
disable_rollback=disable_rollback,
@@ -558,8 +554,7 @@
'SUSPEND' in self.conf.skip_test_stack_action_list):
self.addCleanup(self._stack_delete, stack_identifier)
self.skipTest('Testing Stack suspend disabled in conf, skipping')
- stack_name = stack_identifier.split('/')[0]
- self._handle_in_progress(self.client.actions.suspend, stack_name)
+ self._handle_in_progress(self.client.actions.suspend, stack_identifier)
# improve debugging by first checking the resource's state.
self._wait_for_all_resource_status(stack_identifier,
'SUSPEND_COMPLETE')
@@ -570,8 +565,7 @@
'RESUME' in self.conf.skip_test_stack_action_list):
self.addCleanup(self._stack_delete, stack_identifier)
self.skipTest('Testing Stack resume disabled in conf, skipping')
- stack_name = stack_identifier.split('/')[0]
- self._handle_in_progress(self.client.actions.resume, stack_name)
+ self._handle_in_progress(self.client.actions.resume, stack_identifier)
# improve debugging by first checking the resource's state.
self._wait_for_all_resource_status(stack_identifier,
'RESUME_COMPLETE')
@@ -595,3 +589,11 @@
if len(matched) == num_expected:
return matched
time.sleep(build_interval)
+
+ def check_autoscale_complete(self, stack_id, expected_num):
+ res_list = self.client.resources.list(stack_id)
+ all_res_complete = all(res.resource_status in ('UPDATE_COMPLETE',
+ 'CREATE_COMPLETE')
+ for res in res_list)
+ all_res = len(res_list) == expected_num
+ return all_res and all_res_complete
diff --git a/functional/test_create_update.py b/functional/test_create_update.py
index 8c78951..aa4bdbf 100644
--- a/functional/test_create_update.py
+++ b/functional/test_create_update.py
@@ -150,6 +150,7 @@
properties:
value: Test
fail: {get_param: do_fail}
+ wait_secs: 1
'''
def setUp(self):
diff --git a/functional/test_resources_list.py b/functional/test_resources_list.py
new file mode 100644
index 0000000..257afc5
--- /dev/null
+++ b/functional/test_resources_list.py
@@ -0,0 +1,43 @@
+# 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.
+
+from heat_integrationtests.functional import functional_base
+
+
+test_template_depend = {
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'test1': {
+ 'type': 'OS::Heat::TestResource',
+ 'properties': {
+ 'value': 'Test1',
+ }
+ },
+ 'test2': {
+ 'type': 'OS::Heat::TestResource',
+ 'depends_on': ['test1'],
+ 'properties': {
+ 'value': 'Test2',
+ }
+ }
+ }
+}
+
+
+class ResourcesList(functional_base.FunctionalTestsBase):
+
+ def test_filtering_with_depend(self):
+ stack_identifier = self.stack_create(template=test_template_depend)
+ [test2] = self.client.resources.list(stack_identifier,
+ filters={'name': 'test2'})
+
+ self.assertEqual('CREATE_COMPLETE', test2.resource_status)
diff --git a/scenario/test_autoscaling_lb.py b/scenario/test_autoscaling_lb.py
index f5b292e..833e9a8 100644
--- a/scenario/test_autoscaling_lb.py
+++ b/scenario/test_autoscaling_lb.py
@@ -48,14 +48,6 @@
resp.add(r.text)
self.assertEqual(expected_num, len(resp))
- def autoscale_complete(self, stack_id, expected_num):
- res_list = self.client.resources.list(stack_id)
- all_res_complete = all(res.resource_status in ('UPDATE_COMPLETE',
- 'CREATE_COMPLETE')
- for res in res_list)
- all_res = len(res_list) == expected_num
- return all_res and all_res_complete
-
def test_autoscaling_loadbalancer_neutron(self):
"""Check work of AutoScaing and Neutron LBaaS v1 resource in Heat.
@@ -111,7 +103,7 @@
asg = self.client.resources.get(sid, 'asg')
test.call_until_true(self.conf.build_timeout,
self.conf.build_interval,
- self.autoscale_complete,
+ self.check_autoscale_complete,
asg.physical_resource_id, 2)
# Check number of distinctive responses, must now be 2
diff --git a/scenario/test_autoscaling_lbv2.py b/scenario/test_autoscaling_lbv2.py
index 89c4877..b3a1842 100644
--- a/scenario/test_autoscaling_lbv2.py
+++ b/scenario/test_autoscaling_lbv2.py
@@ -48,14 +48,6 @@
resp.add(r.text)
self.assertEqual(expected_num, len(resp))
- def autoscale_complete(self, stack_id, expected_num):
- res_list = self.client.resources.list(stack_id)
- all_res_complete = all(res.resource_status in ('UPDATE_COMPLETE',
- 'CREATE_COMPLETE')
- for res in res_list)
- all_res = len(res_list) == expected_num
- return all_res and all_res_complete
-
def test_autoscaling_loadbalancer_neutron(self):
"""Check work of AutoScaing and Neutron LBaaS v2 resource in Heat.
@@ -109,7 +101,7 @@
asg = self.client.resources.get(sid, 'asg')
test.call_until_true(self.conf.build_timeout,
self.conf.build_interval,
- self.autoscale_complete,
+ self.check_autoscale_complete,
asg.physical_resource_id, 2)
# Check number of distinctive responses, must now be 2