Add support for zed
Change-Id: I40c546e24fb0b611ddad6126a20ccecb143ea723
This commit is contained in:
parent
eabda77cbd
commit
fe3f501895
34
.zuul.yaml
34
.zuul.yaml
@ -1,7 +1,7 @@
|
||||
- project:
|
||||
name: x/group-based-policy-automation
|
||||
templates:
|
||||
- openstack-python3-yoga-jobs
|
||||
- openstack-python3-zed-jobs
|
||||
- publish-to-pypi
|
||||
# REVISIT: In the jobs below, the required-projects clause is needed on
|
||||
# the master branch to select the correct version of the requirements
|
||||
@ -14,34 +14,26 @@
|
||||
- openstack-tox-pep8:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/yoga
|
||||
- openstack-tox-py36:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/yoga
|
||||
- openstack-tox-py37:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/yoga
|
||||
override-checkout: stable/zed
|
||||
- openstack-tox-py38:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/yoga
|
||||
override-checkout: stable/zed
|
||||
- openstack-tox-py39:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/zed
|
||||
gate:
|
||||
jobs:
|
||||
- openstack-tox-pep8:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/yoga
|
||||
- openstack-tox-py36:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/yoga
|
||||
- openstack-tox-py37:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/yoga
|
||||
override-checkout: stable/zed
|
||||
- openstack-tox-py38:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/yoga
|
||||
override-checkout: stable/zed
|
||||
- openstack-tox-py39:
|
||||
required-projects:
|
||||
- name: openstack/requirements
|
||||
override-checkout: stable/zed
|
||||
|
@ -88,296 +88,6 @@ service_profile_template = '''
|
||||
'''
|
||||
|
||||
|
||||
class ServiceChainNodeTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ServiceChainNodeTest, self).setUp()
|
||||
self.mock_create = mock.patch(
|
||||
'gbpclient.v2_0.client.Client.create_servicechain_node')
|
||||
self.mock_delete = mock.patch(
|
||||
'gbpclient.v2_0.client.Client.delete_servicechain_node')
|
||||
self.mock_show = mock.patch(
|
||||
'gbpclient.v2_0.client.Client.show_servicechain_node')
|
||||
self.mock_update = mock.patch(
|
||||
'gbpclient.v2_0.client.Client.update_servicechain_node')
|
||||
self.mock_create.start()
|
||||
self.mock_delete.start()
|
||||
self.mock_show.start()
|
||||
self.mock_update.start()
|
||||
self.stub_keystoneclient()
|
||||
|
||||
def tearDown(self):
|
||||
self.mock_create.stop()
|
||||
self.mock_delete.stop()
|
||||
self.mock_show.stop()
|
||||
self.mock_update.stop()
|
||||
super(ServiceChainNodeTest, self).tearDown()
|
||||
|
||||
def create_servicechain_node(self):
|
||||
call_dict = {
|
||||
'servicechain_node': {
|
||||
"name": "test-sc-node",
|
||||
"description": "test service chain node resource",
|
||||
"service_profile_id": "profile-id",
|
||||
"shared": True,
|
||||
"config": "{'name': 'sc_node_config'}"
|
||||
}
|
||||
}
|
||||
tdict = {'servicechain_node': {'id': '5678'}}
|
||||
gbpclient.Client.create_servicechain_node.return_value = tdict
|
||||
|
||||
ret_val = gbpclient.Client.create_servicechain_node(call_dict)
|
||||
expected = mock.call(call_dict)
|
||||
_mocked_create = self.mock_create.get_original()[0]
|
||||
_mocked_create.assert_has_calls([expected])
|
||||
self.assertEqual(tdict, ret_val)
|
||||
|
||||
snippet = template_format.parse(servicechain_node_template)
|
||||
self.stack = utils.parse_stack(snippet)
|
||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||
return servicechain.ServiceChainNode(
|
||||
'servicechain_node', resource_defns['servicechain_node'],
|
||||
self.stack)
|
||||
|
||||
def test_create(self):
|
||||
rsrc = self.create_servicechain_node()
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
def test_create_failed(self):
|
||||
call_dict = {
|
||||
'servicechain_node': {
|
||||
"name": "test-sc-node",
|
||||
"description": "test service chain node resource",
|
||||
"service_profile_id": "profile-id",
|
||||
"shared": True,
|
||||
"config": "{'name': 'sc_node_config'}"
|
||||
}
|
||||
}
|
||||
exc = servicechain.NeutronClientException()
|
||||
gbpclient.Client.create_servicechain_node.side_effect = exc
|
||||
|
||||
snippet = template_format.parse(servicechain_node_template)
|
||||
self.stack = utils.parse_stack(snippet)
|
||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||
rsrc = servicechain.ServiceChainNode(
|
||||
'servicechain_node', resource_defns['servicechain_node'],
|
||||
self.stack)
|
||||
|
||||
error = self.assertRaises(exception.ResourceFailure,
|
||||
scheduler.TaskRunner(rsrc.create))
|
||||
self.assertEqual(
|
||||
'NeutronClientException: resources.servicechain_node: '
|
||||
'An unknown exception occurred.',
|
||||
six.text_type(error))
|
||||
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)
|
||||
|
||||
expected = mock.call(call_dict)
|
||||
_mocked_create = self.mock_create.get_original()[0]
|
||||
_mocked_create.assert_has_calls([expected])
|
||||
|
||||
def test_delete(self):
|
||||
exc = servicechain.NeutronClientException(status_code=404)
|
||||
gbpclient.Client.show_servicechain_node.side_effect = exc
|
||||
|
||||
rsrc = self.create_servicechain_node()
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
scheduler.TaskRunner(rsrc.delete)()
|
||||
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
expected = mock.call('5678')
|
||||
_mocked_show = self.mock_show.get_original()[0]
|
||||
_mocked_show.assert_has_calls([expected])
|
||||
|
||||
def test_delete_already_gone(self):
|
||||
exc = servicechain.NeutronClientException(status_code=404)
|
||||
gbpclient.Client.delete_servicechain_node.side_effect = exc
|
||||
|
||||
rsrc = self.create_servicechain_node()
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
scheduler.TaskRunner(rsrc.delete)()
|
||||
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
expected = mock.call('5678')
|
||||
_mocked_delete = self.mock_delete.get_original()[0]
|
||||
_mocked_delete.assert_has_calls([expected])
|
||||
|
||||
def test_delete_failed(self):
|
||||
exc = servicechain.NeutronClientException(status_code=400)
|
||||
gbpclient.Client.delete_servicechain_node.side_effect = exc
|
||||
|
||||
rsrc = self.create_servicechain_node()
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
error = self.assertRaises(exception.ResourceFailure,
|
||||
scheduler.TaskRunner(rsrc.delete))
|
||||
self.assertEqual(
|
||||
'NeutronClientException: resources.servicechain_node: '
|
||||
'An unknown exception occurred.',
|
||||
six.text_type(error))
|
||||
self.assertEqual((rsrc.DELETE, rsrc.FAILED), rsrc.state)
|
||||
|
||||
expected = mock.call('5678')
|
||||
_mocked_delete = self.mock_delete.get_original()[0]
|
||||
_mocked_delete.assert_has_calls([expected])
|
||||
|
||||
def test_update(self):
|
||||
rsrc = self.create_servicechain_node()
|
||||
call_dict = {'servicechain_node': {'name': 'node_update'}}
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
|
||||
update_template = copy.deepcopy(rsrc.t)
|
||||
update_template._properties['name'] = 'node_update'
|
||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||
|
||||
expected = mock.call('5678', call_dict)
|
||||
_mocked_update = self.mock_update.get_original()[0]
|
||||
_mocked_update.assert_has_calls([expected])
|
||||
|
||||
|
||||
class ServiceChainSpecTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(ServiceChainSpecTest, self).setUp()
|
||||
self.mock_create = mock.patch(
|
||||
'gbpclient.v2_0.client.Client.create_servicechain_spec')
|
||||
self.mock_delete = mock.patch(
|
||||
'gbpclient.v2_0.client.Client.delete_servicechain_spec')
|
||||
self.mock_show = mock.patch(
|
||||
'gbpclient.v2_0.client.Client.show_servicechain_spec')
|
||||
self.mock_update = mock.patch(
|
||||
'gbpclient.v2_0.client.Client.update_servicechain_spec')
|
||||
self.mock_create.start()
|
||||
self.mock_delete.start()
|
||||
self.mock_show.start()
|
||||
self.mock_update.start()
|
||||
self.stub_keystoneclient()
|
||||
|
||||
def tearDown(self):
|
||||
self.mock_create.stop()
|
||||
self.mock_delete.stop()
|
||||
self.mock_show.stop()
|
||||
self.mock_update.stop()
|
||||
super(ServiceChainSpecTest, self).tearDown()
|
||||
|
||||
def create_servicechain_spec(self):
|
||||
call_dict = {
|
||||
"servicechain_spec": {
|
||||
"name": "test-sc-spec",
|
||||
"description": "test service chain spec resource",
|
||||
"shared": True,
|
||||
"nodes": ["1234", "7890"]
|
||||
}
|
||||
}
|
||||
tdict = {'servicechain_spec': {'id': '5678'}}
|
||||
gbpclient.Client.create_servicechain_spec.return_value = tdict
|
||||
|
||||
ret_val = gbpclient.Client.create_servicechain_spec(call_dict)
|
||||
expected = mock.call(call_dict)
|
||||
_mocked_create = self.mock_create.get_original()[0]
|
||||
_mocked_create.assert_has_calls([expected])
|
||||
self.assertEqual(tdict, ret_val)
|
||||
|
||||
snippet = template_format.parse(servicechain_spec_template)
|
||||
self.stack = utils.parse_stack(snippet)
|
||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||
return servicechain.ServiceChainSpec(
|
||||
'servicechain_spec', resource_defns['servicechain_spec'],
|
||||
self.stack)
|
||||
|
||||
def test_create(self):
|
||||
rsrc = self.create_servicechain_spec()
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
def test_create_failed(self):
|
||||
call_dict = {
|
||||
'servicechain_spec': {
|
||||
"name": "test-sc-spec",
|
||||
"description": "test service chain spec resource",
|
||||
"shared": True,
|
||||
"nodes": ["1234", "7890"]
|
||||
}
|
||||
}
|
||||
exc = servicechain.NeutronClientException()
|
||||
gbpclient.Client.create_servicechain_spec.side_effect = exc
|
||||
|
||||
snippet = template_format.parse(servicechain_spec_template)
|
||||
self.stack = utils.parse_stack(snippet)
|
||||
resource_defns = self.stack.t.resource_definitions(self.stack)
|
||||
rsrc = servicechain.ServiceChainSpec(
|
||||
'servicechain_spec', resource_defns['servicechain_spec'],
|
||||
self.stack)
|
||||
|
||||
error = self.assertRaises(exception.ResourceFailure,
|
||||
scheduler.TaskRunner(rsrc.create))
|
||||
self.assertEqual(
|
||||
'NeutronClientException: resources.servicechain_spec: '
|
||||
'An unknown exception occurred.',
|
||||
six.text_type(error))
|
||||
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)
|
||||
|
||||
expected = mock.call(call_dict)
|
||||
_mocked_create = self.mock_create.get_original()[0]
|
||||
_mocked_create.assert_has_calls([expected])
|
||||
|
||||
def test_delete(self):
|
||||
exc = servicechain.NeutronClientException(status_code=404)
|
||||
gbpclient.Client.show_servicechain_spec.side_effect = exc
|
||||
|
||||
rsrc = self.create_servicechain_spec()
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
scheduler.TaskRunner(rsrc.delete)()
|
||||
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
expected = mock.call('5678')
|
||||
_mocked_show = self.mock_show.get_original()[0]
|
||||
_mocked_show.assert_has_calls([expected])
|
||||
|
||||
def test_delete_already_gone(self):
|
||||
exc = servicechain.NeutronClientException(status_code=404)
|
||||
gbpclient.Client.delete_servicechain_spec.side_effect = exc
|
||||
|
||||
rsrc = self.create_servicechain_spec()
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
scheduler.TaskRunner(rsrc.delete)()
|
||||
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
|
||||
|
||||
expected = mock.call('5678')
|
||||
_mocked_delete = self.mock_delete.get_original()[0]
|
||||
_mocked_delete.assert_has_calls([expected])
|
||||
|
||||
def test_delete_failed(self):
|
||||
exc = servicechain.NeutronClientException(status_code=400)
|
||||
gbpclient.Client.delete_servicechain_spec.side_effect = exc
|
||||
|
||||
rsrc = self.create_servicechain_spec()
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
error = self.assertRaises(exception.ResourceFailure,
|
||||
scheduler.TaskRunner(rsrc.delete))
|
||||
self.assertEqual(
|
||||
'NeutronClientException: resources.servicechain_spec: '
|
||||
'An unknown exception occurred.',
|
||||
six.text_type(error))
|
||||
self.assertEqual((rsrc.DELETE, rsrc.FAILED), rsrc.state)
|
||||
|
||||
expected = mock.call('5678')
|
||||
_mocked_delete = self.mock_delete.get_original()[0]
|
||||
_mocked_delete.assert_has_calls([expected])
|
||||
|
||||
def test_update(self):
|
||||
rsrc = self.create_servicechain_spec()
|
||||
call_dict = {'servicechain_spec': {'name': 'spec_update'}}
|
||||
scheduler.TaskRunner(rsrc.create)()
|
||||
|
||||
update_template = copy.deepcopy(rsrc.t)
|
||||
update_template._properties['name'] = 'spec_update'
|
||||
scheduler.TaskRunner(rsrc.update, update_template)()
|
||||
|
||||
expected = mock.call('5678', call_dict)
|
||||
_mocked_update = self.mock_update.get_original()[0]
|
||||
_mocked_update.assert_has_calls([expected])
|
||||
|
||||
|
||||
class ServiceProfileTest(HeatTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
@ -2,8 +2,8 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
-e git+https://opendev.org/openstack/heat.git@stable/yoga#egg=openstack-heat
|
||||
-e git+https://opendev.org/x/python-group-based-policy-client.git@stable/yoga#egg=python-group-based-policy-client
|
||||
-e git+https://opendev.org/openstack/heat.git@stable/zed#egg=openstack-heat
|
||||
-e git+https://opendev.org/x/python-group-based-policy-client.git@stable/zed#egg=python-group-based-policy-client
|
||||
# Hacking already pins down pep8, pyflakes and flake8
|
||||
hacking>=3.0.1,<3.1.0; # Apache-2.0
|
||||
# remove this pyflakes from here once you bump the
|
||||
|
2
tox.ini
2
tox.ini
@ -14,7 +14,7 @@ setenv = VIRTUAL_ENV={envdir}
|
||||
usedevelop = True
|
||||
install_command = pip install {opts} {packages}
|
||||
deps =
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/yoga}
|
||||
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/zed}
|
||||
-r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
commands =
|
||||
|
Loading…
x
Reference in New Issue
Block a user