summaryrefslogtreecommitdiff
path: root/trove/tests/unittests/common
diff options
context:
space:
mode:
authorAmrith Kumar <amrith@tesora.com>2016-10-12 11:04:05 -0400
committerAmrith Kumar <amrith.kumar@gmail.com>2017-05-26 20:09:38 +0000
commit0efb9b1cba03731566136fd97d033c16d2953f75 (patch)
tree6278768404951cbe69b5bd55410ee17fc3532dd4 /trove/tests/unittests/common
parent012da9a334bc4e9c7711dc918eea3f011463ec82 (diff)
downloadtrove-0efb9b1cba03731566136fd97d033c16d2953f75.tar.gz
Remove Trove's support for Heat
This is now master ... ocata has been branched. It is important to clarify what this is because it is a confusing statement. If you are using heat and want to use heat to provision a trove instance, that will work. Heat can call the Trove API and things will work. On the other hand, if Trove wants to provision an instance, it will not use Heat. This change eliminates all support for heat within Trove; you can't use a heat template as the mechanism that Trove will use to provision resources. Depends-On: I2f2a12207581a94fb8561a6d65a3a79b4a29b063 Change-Id: I964cdd3ae67261b6fd7f666b7795b35e12788c9c
Diffstat (limited to 'trove/tests/unittests/common')
-rw-r--r--trove/tests/unittests/common/test_remote.py79
-rw-r--r--trove/tests/unittests/common/test_template.py86
2 files changed, 0 insertions, 165 deletions
diff --git a/trove/tests/unittests/common/test_remote.py b/trove/tests/unittests/common/test_remote.py
index e58562d8..46bd90af 100644
--- a/trove/tests/unittests/common/test_remote.py
+++ b/trove/tests/unittests/common/test_remote.py
@@ -427,85 +427,6 @@ class TestCreateNovaClient(trove_testtools.TestCase):
admin_client.client.management_url)
-class TestCreateHeatClient(trove_testtools.TestCase):
- def setUp(self):
- super(TestCreateHeatClient, self).setUp()
- self.heat_public_url = 'http://publicURL/v2'
- self.heatv3_public_url_region_two = 'http://publicURL-r2/v3'
- self.service_catalog = [
- {
- 'endpoints': [
- {
- 'region': 'RegionOne',
- 'publicURL': self.heat_public_url,
- }
- ],
- 'type': 'orchestration'
- },
- {
- 'endpoints': [
- {
- 'region': 'RegionOne',
- 'publicURL': 'http://publicURL-r1/v1',
- },
- {
- 'region': 'RegionTwo',
- 'publicURL': self.heatv3_public_url_region_two,
- }
- ],
- 'type': 'orchestrationv3'
- }
- ]
-
- def tearDown(self):
- super(TestCreateHeatClient, self).tearDown()
- cfg.CONF.clear_override('heat_url')
- cfg.CONF.clear_override('heat_service_type')
- cfg.CONF.clear_override('os_region_name')
-
- def test_create_with_no_conf_no_catalog(self):
- self.assertRaises(exception.EmptyCatalog,
- remote.create_heat_client,
- TroveContext())
-
- def test_create_with_conf_override(self):
- heat_url_from_conf = 'http://example.com'
- tenant_from_ctx = uuid.uuid4().hex
- cfg.CONF.set_override('heat_url', heat_url_from_conf,
- enforce_type=True)
-
- client = remote.create_heat_client(
- TroveContext(tenant=tenant_from_ctx))
- self.assertEqual('%s/%s' % (heat_url_from_conf, tenant_from_ctx),
- client.http_client.endpoint)
-
- def test_create_with_conf_override_trailing_slash(self):
- heat_url_from_conf = 'http://example.com/'
- tenant_from_ctx = uuid.uuid4().hex
- cfg.CONF.set_override('heat_url', heat_url_from_conf,
- enforce_type=True)
- client = remote.create_heat_client(
- TroveContext(tenant=tenant_from_ctx))
- self.assertEqual('%s%s' % (heat_url_from_conf, tenant_from_ctx),
- client.http_client.endpoint)
-
- def test_create_with_catalog_and_default_service_type(self):
- client = remote.create_heat_client(
- TroveContext(service_catalog=self.service_catalog))
- self.assertEqual(self.heat_public_url,
- client.http_client.endpoint)
-
- def test_create_with_catalog_all_opts(self):
- cfg.CONF.set_override('heat_service_type', 'orchestrationv3',
- enforce_type=True)
- cfg.CONF.set_override('os_region_name', 'RegionTwo',
- enforce_type=True)
- client = remote.create_heat_client(
- TroveContext(service_catalog=self.service_catalog))
- self.assertEqual(self.heatv3_public_url_region_two,
- client.http_client.endpoint)
-
-
class TestCreateSwiftClient(trove_testtools.TestCase):
def setUp(self):
super(TestCreateSwiftClient, self).setUp()
diff --git a/trove/tests/unittests/common/test_template.py b/trove/tests/unittests/common/test_template.py
index 13b3d0ff..9a77ef8f 100644
--- a/trove/tests/unittests/common/test_template.py
+++ b/trove/tests/unittests/common/test_template.py
@@ -13,9 +13,7 @@ import re
from mock import Mock
-from trove.common import exception
from trove.common import template
-from trove.common import utils
from trove.datastore.models import DatastoreVersion
from trove.tests.unittests import trove_testtools
from trove.tests.unittests.util import util
@@ -103,87 +101,3 @@ class TemplateTest(trove_testtools.TestCase):
self.flavor_dict,
self.server_id)
self.assertTrue(self._find_in_template(config.render(), "relay_log"))
-
-
-class HeatTemplateLoadTest(trove_testtools.TestCase):
-
- class FakeTemplate(object):
- def __init__(self):
- self.name = 'mysql/heat.template'
-
- def setUp(self):
- self.default = 'default.heat.template'
- self.orig_1 = utils.ENV.list_templates
- self.orig_2 = utils.ENV.get_template
- super(HeatTemplateLoadTest, self).setUp()
-
- def tearDown(self):
- utils.ENV.list_templates = self.orig_1
- utils.ENV.get_template = self.orig_2
- super(HeatTemplateLoadTest, self).tearDown()
-
- def test_heat_template_load_with_invalid_datastore(self):
- invalid_datastore = 'mysql-blah'
- self.assertRaises(exception.InvalidDatastoreManager,
- template.load_heat_template,
- invalid_datastore)
-
- def test_heat_template_load_non_default(self):
- orig = utils.ENV._load_template
- utils.ENV._load_template = Mock(return_value=self.FakeTemplate())
- mysql_tmpl = template.load_heat_template('mysql')
- self.assertNotEqual(mysql_tmpl.name, self.default)
- utils.ENV._load_template = orig
-
- def test_heat_template_load_success(self):
- mysql_tmpl = template.load_heat_template('mysql')
- redis_tmpl = template.load_heat_template('redis')
- cassandra_tmpl = template.load_heat_template('cassandra')
- mongo_tmpl = template.load_heat_template('mongodb')
- percona_tmpl = template.load_heat_template('percona')
- couchbase_tmpl = template.load_heat_template('couchbase')
- self.assertIsNotNone(mysql_tmpl)
- self.assertIsNotNone(redis_tmpl)
- self.assertIsNotNone(cassandra_tmpl)
- self.assertIsNotNone(mongo_tmpl)
- self.assertIsNotNone(percona_tmpl)
- self.assertIsNotNone(couchbase_tmpl)
- self.assertEqual(self.default, mysql_tmpl.name)
- self.assertEqual(self.default, redis_tmpl.name)
- self.assertEqual(self.default, cassandra_tmpl.name)
- self.assertEqual(self.default, mongo_tmpl.name)
- self.assertEqual(self.default, percona_tmpl.name)
- self.assertEqual(self.default, couchbase_tmpl.name)
-
- def test_render_templates_with_ports_from_config(self):
- mysql_tmpl = template.load_heat_template('mysql')
- tcp_rules = [{'cidr': "0.0.0.0/0",
- 'from_': 3306,
- 'to_': 3309},
- {'cidr': "0.0.0.0/0",
- 'from_': 3320,
- 'to_': 33022}]
- output = mysql_tmpl.render(
- volume_support=True,
- ifaces=[], ports=[],
- tcp_rules=tcp_rules,
- udp_rules=[],
- files={})
- self.assertIsNotNone(output)
- self.assertIn('FromPort: "3306"', output)
- self.assertIn('ToPort: "3309"', output)
- self.assertIn('CidrIp: "0.0.0.0/0"', output)
- self.assertIn('FromPort: "3320"', output)
- self.assertIn('ToPort: "33022"', output)
-
- def test_no_rules_if_no_ports(self):
- mysql_tmpl = template.load_heat_template('mysql')
- output = mysql_tmpl.render(
- volume_support=True,
- ifaces=[], ports=[],
- tcp_rules=[],
- udp_rules=[],
- files={})
- self.assertIsNotNone(output)
- self.assertNotIn('- IpProtocol: "tcp"', output)
- self.assertNotIn('- IpProtocol: "udp"', output)