Merge "Including a description field for environment and environment templates"
This commit is contained in:
commit
61f3017fc7
@ -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')
|
@ -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)
|
||||
|
@ -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]}
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -0,0 +1,2 @@
|
||||
features:
|
||||
- Adding description for environment and environment templates.
|
Loading…
Reference in New Issue
Block a user