diff --git a/murano/db/migration/alembic_migrations/versions/015_adding_text_description.py b/murano/db/migration/alembic_migrations/versions/015_adding_text_description.py new file mode 100644 index 00000000..f8de8f6c --- /dev/null +++ b/murano/db/migration/alembic_migrations/versions/015_adding_text_description.py @@ -0,0 +1,47 @@ +# Copyright 2016 OpenStack Foundation. +# +# 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. + +"""Increase time resolution for status reports + +Revision ID: 015 +Create Date: 2016-06-17 + +""" + +# revision identifiers, used by Alembic. +revision = '015' +down_revision = '014' + +from alembic import op +import sqlalchemy as sa + + +MYSQL_ENGINE = 'InnoDB' +MYSQL_CHARSET = 'utf8' + + +def upgrade(): + op.add_column('environment', sa.Column('description_text', sa.Text(), + nullable=True)) + op.add_column('environment-template', sa.Column('description_text', + sa.Text(), + nullable=True)) + + +def downgrade(): + with op.batch_alter_table("environment") as batch_op: + batch_op.drop_column('description_text') + with op.batch_alter_table("environment-template") as batch_op2: + batch_op2.drop_column('description_text') diff --git a/murano/db/models.py b/murano/db/models.py index 73b4ffbf..2cfe2778 100644 --- a/murano/db/models.py +++ b/murano/db/models.py @@ -65,6 +65,7 @@ class Environment(Base, TimestampMixin): default=uuidutils.generate_uuid) name = sa.Column(sa.String(255), nullable=False) tenant_id = sa.Column(sa.String(36), nullable=False) + description_text = sa.Column(sa.String(), nullable=False, default='') version = sa.Column(sa.BigInteger, nullable=False, default=0) description = sa.Column(st.JsonBlob(), nullable=False, default={}) @@ -96,6 +97,7 @@ class EnvironmentTemplate(Base, TimestampMixin): default=uuidutils.generate_uuid) name = sa.Column(sa.String(255), nullable=False) tenant_id = sa.Column(sa.String(36), nullable=False) + description_text = sa.Column(sa.String(), nullable=False, default='') version = sa.Column(sa.BigInteger, nullable=False, default=0) description = sa.Column(st.JsonBlob(), nullable=False, default={}) is_public = sa.Column(sa.Boolean, default=False) diff --git a/murano/tests/unit/api/v1/test_env_templates.py b/murano/tests/unit/api/v1/test_env_templates.py index f7eed495..9a927978 100644 --- a/murano/tests/unit/api/v1/test_env_templates.py +++ b/murano/tests/unit/api/v1/test_env_templates.py @@ -58,11 +58,12 @@ class TestEnvTemplateApi(tb.ControllerTest, tb.MuranoApiTestCase): 'id': 'env_template_id', 'is_public': False, 'name': 'mytemp', + 'description_text': 'description', 'version': 0, 'created': timeutils.isotime(fake_now)[:-1], 'updated': timeutils.isotime(fake_now)[:-1]} - body = {'name': 'mytemp'} + body = {'name': 'mytemp', 'description_text': 'description'} req = self._post('/templates', jsonutils.dump_as_bytes(body)) result = req.get_response(self.api) @@ -337,6 +338,7 @@ class TestEnvTemplateApi(tb.ControllerTest, tb.MuranoApiTestCase): created=fake_now, updated=fake_now, tenant_id=self.tenant, + description_text='', description={ 'name': 'my-temp', '?': {'id': '12345'} @@ -418,6 +420,7 @@ class TestEnvTemplateApi(tb.ControllerTest, tb.MuranoApiTestCase): 'id': self.uuids[0], 'is_public': False, 'name': 'env_template_name', + 'description_text': '', 'version': 0, 'created': timeutils.isotime(fake_now)[:-1], 'updated': timeutils.isotime(fake_now)[:-1]} diff --git a/murano/tests/unit/api/v1/test_environments.py b/murano/tests/unit/api/v1/test_environments.py index 3d22d2d7..39f7af56 100644 --- a/murano/tests/unit/api/v1/test_environments.py +++ b/murano/tests/unit/api/v1/test_environments.py @@ -87,12 +87,13 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase): expected = {'tenant_id': self.tenant, 'id': 'environment_id', 'name': 'my_env', + 'description_text': 'description', 'version': 0, 'created': timeutils.isotime(fake_now)[:-1], 'updated': timeutils.isotime(fake_now)[:-1], } - body = {'name': 'my_env'} + body = {'name': 'my_env', 'description_text': 'description'} req = self._post('/environments', jsonutils.dump_as_bytes(body)) result = req.get_response(self.api) self.assertEqual(expected, jsonutils.loads(result.body)) @@ -220,6 +221,7 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase): id='12345', name='my-env', version=0, + description_text='', created=fake_now, updated=fake_now, tenant_id=self.tenant, @@ -379,6 +381,7 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase): 'id': env_id, 'name': 'my-env', 'version': 0, + 'description_text': '', 'created': timeutils.isotime(fake_now)[:-1], 'updated': timeutils.isotime(fake_now)[:-1], 'acquired_by': None, @@ -425,6 +428,7 @@ class TestEnvironmentApi(tb.ControllerTest, tb.MuranoApiTestCase): 'id': env_id, 'name': 'my-env', 'version': 0, + 'description_text': '', 'created': timeutils.isotime(fake_now)[:-1], 'updated': timeutils.isotime(fake_now)[:-1], 'acquired_by': sess_id, diff --git a/murano_tempest_tests/services/application_catalog/application_catalog_client.py b/murano_tempest_tests/services/application_catalog/application_catalog_client.py index 0e73e321..6507217a 100644 --- a/murano_tempest_tests/services/application_catalog/application_catalog_client.py +++ b/murano_tempest_tests/services/application_catalog/application_catalog_client.py @@ -279,7 +279,8 @@ class ApplicationCatalogClient(rest_client.RestClient): return self._parse_resp(body) def create_env_template(self, env_template_name): - body = {'name': env_template_name, "is_public": False} + body = {'name': env_template_name, "is_public": False, + "description_text": "description"} uri = 'v1/templates' resp, body = self.post(uri, json.dumps(body)) self.expected_success(200, resp.status) diff --git a/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py b/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py index 1e394324..fed3cd99 100644 --- a/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py +++ b/murano_tempest_tests/tests/api/application_catalog/test_env_templates.py @@ -34,6 +34,7 @@ class TestEnvironmentTemplatesSanity(base.BaseApplicationCatalogTest): create_env_template(name) self.assertFalse(env_template['is_public']) self.assertEqual(name, env_template['name']) + self.assertEqual("description", env_template['description_text']) env_templates_list = self.application_catalog_client.\ get_env_templates_list() self.assertIn(env_template, env_templates_list) diff --git a/releasenotes/notes/fixed-adding_text_description-25bd77f36ee370ba.yaml b/releasenotes/notes/fixed-adding_text_description-25bd77f36ee370ba.yaml new file mode 100644 index 00000000..2130fe4c --- /dev/null +++ b/releasenotes/notes/fixed-adding_text_description-25bd77f36ee370ba.yaml @@ -0,0 +1,2 @@ +features: + - Adding description for environment and environment templates.