From e6d97384d3c47df9f78887a5603e4baa65705dfe Mon Sep 17 00:00:00 2001 From: Trevor McKay Date: Wed, 19 Mar 2014 13:19:07 -0400 Subject: [PATCH] Change remaining 'savanna' references in sahara/tests These changes remove the remaining 'savanna' references under the 'tests' dir to 'sahara' and modify necessary files outside of 'tests' to make unit and integration tests pass. * Change member savanna_config to sahara_config for alembic * Change description strings in sahara/resources * Change exception strings in plugin validation * Change tests/README * Change param names, defaults, and help in integration tests config.py * Change alembic migration test lock prefix * Change SAVANNA_MYSQL_PRESENT and SAVANNA_TEST_POSTGRESQL_PRESENT in alembic tests * Change 'Generated by' message in crypto.py Partial-Implements: blueprint savanna-renaming-service Change-Id: I11e1bab1fce76a411a8659b947e7bae90ea521a9 --- sahara/db/migration/alembic_migrations/env.py | 6 ++--- sahara/db/migration/cli.py | 2 +- sahara/resources/main.heat | 2 +- sahara/service/validations/base.py | 2 +- sahara/tests/README.rst | 4 +-- sahara/tests/integration/README.rst | 4 +-- sahara/tests/integration/configs/config.py | 26 +++++++++---------- .../integration/configs/itest.conf.sample | 6 ++--- .../configs/itest.conf.sample-full | 26 +++++++++---------- sahara/tests/integration/tests/base.py | 10 +++---- .../unit/db/migration/test_migrations_base.py | 8 +++--- .../test_serialize_resources_aa.heat | 2 +- .../test_serialize_resources_use_neutron.heat | 2 +- .../test_cluster_create_validation.py | 2 +- ...test_cluster_template_create_validation.py | 2 +- sahara/tests/unit/utils/test_crypto.py | 2 +- sahara/utils/crypto.py | 2 +- 17 files changed, 54 insertions(+), 54 deletions(-) diff --git a/sahara/db/migration/alembic_migrations/env.py b/sahara/db/migration/alembic_migrations/env.py index b72b9145f5..4d1fb5c4c9 100644 --- a/sahara/db/migration/alembic_migrations/env.py +++ b/sahara/db/migration/alembic_migrations/env.py @@ -31,7 +31,7 @@ importutils.import_module('sahara.db.sqlalchemy.models') # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config -savanna_config = config.savanna_config +sahara_config = config.sahara_config # Interpret the config file for Python logging. # This line sets up loggers basically. @@ -61,7 +61,7 @@ def run_migrations_offline(): script output. """ - context.configure(url=savanna_config.database.connection) + context.configure(url=sahara_config.database.connection) with context.begin_transaction(): context.run_migrations() @@ -75,7 +75,7 @@ def run_migrations_online(): """ engine = create_engine( - savanna_config.database.connection, + sahara_config.database.connection, poolclass=pool.NullPool) connection = engine.connect() diff --git a/sahara/db/migration/cli.py b/sahara/db/migration/cli.py index c9f43c5374..b248f0ea68 100644 --- a/sahara/db/migration/cli.py +++ b/sahara/db/migration/cli.py @@ -105,7 +105,7 @@ def main(): config.set_main_option('script_location', 'sahara.db.migration:alembic_migrations') # attach the Sahara conf to the Alembic conf - config.savanna_config = CONF + config.sahara_config = CONF CONF(project='sahara') CONF.command.func(config, CONF.command.name) diff --git a/sahara/resources/main.heat b/sahara/resources/main.heat index afbe6736df..5be06e4142 100644 --- a/sahara/resources/main.heat +++ b/sahara/resources/main.heat @@ -1,6 +1,6 @@ { "AWSTemplateFormatVersion" : "2010-09-09", - "Description" : "Hadoop Cluster by Savanna", + "Description" : "Hadoop Cluster by Sahara", "Resources" : { diff --git a/sahara/service/validations/base.py b/sahara/service/validations/base.py index f59d354926..66cdfcd9a2 100644 --- a/sahara/service/validations/base.py +++ b/sahara/service/validations/base.py @@ -45,7 +45,7 @@ def _get_plugin_configs(plugin_name, hadoop_version, scope=None): def check_plugin_name_exists(name): if name not in [p.name for p in api.get_plugins()]: - raise ex.InvalidException("Savanna doesn't contain plugin with name " + raise ex.InvalidException("Sahara doesn't contain plugin with name " "'%s'" % name) diff --git a/sahara/tests/README.rst b/sahara/tests/README.rst index 29a80de6b3..2172fa90e9 100644 --- a/sahara/tests/README.rst +++ b/sahara/tests/README.rst @@ -1,6 +1,6 @@ ===================== -Savanna Testing Infra +Sahara Testing Infra ===================== This README file attempts to provide current and prospective contributors with -everything they need to know in order to start creating unit tests for Savanna. +everything they need to know in order to start creating unit tests for Sahara. diff --git a/sahara/tests/integration/README.rst b/sahara/tests/integration/README.rst index e8e7c39625..34f7fe548d 100644 --- a/sahara/tests/integration/README.rst +++ b/sahara/tests/integration/README.rst @@ -1,4 +1,4 @@ -Integration tests for Savanna project +Integration tests for Sahara project ===================================== How to run @@ -25,7 +25,7 @@ For example: `tox -e integration -- vanilla` or `tox -e integration vanilla hdp` Contents -------- -These integration tests check capacity for work of two plugins for Savanna: +These integration tests check capacity for work of two plugins for Sahara: Vanilla and HDP. Vanilla plugin has the following checks: diff --git a/sahara/tests/integration/configs/config.py b/sahara/tests/integration/configs/config.py index 10d528d81c..d457024e5b 100644 --- a/sahara/tests/integration/configs/config.py +++ b/sahara/tests/integration/configs/config.py @@ -52,15 +52,15 @@ COMMON_CONFIG_OPTS = [ cfg.StrOpt('SWIFT_AUTH_VERSION', default=2, help='OpenStack auth version for Swift.'), - cfg.StrOpt('SAVANNA_HOST', + cfg.StrOpt('SAHARA_HOST', default='127.0.0.1', - help='Host for Savanna.'), - cfg.IntOpt('SAVANNA_PORT', + help='Host for Sahara.'), + cfg.IntOpt('SAHARA_PORT', default=8386, - help='Port for Savanna.'), - cfg.StrOpt('SAVANNA_API_VERSION', + help='Port for Sahara.'), + cfg.StrOpt('SAHARA_API_VERSION', default='1.1', - help='API version for Savanna.'), + help='API version for Sahara.'), cfg.StrOpt('FLAVOR_ID', default=None, help='OpenStack flavor ID for virtual machines. If you leave ' @@ -91,8 +91,8 @@ COMMON_CONFIG_OPTS = [ default='test-cluster', help='Name for cluster.'), cfg.StrOpt('USER_KEYPAIR_ID', - default='savanna-i-test-key-pair', - help='OpenStack key pair ID of your SSH public key. Savanna ' + default='sahara-i-test-key-pair', + help='OpenStack key pair ID of your SSH public key. Sahara ' 'transfers this key to cluster nodes for access by users ' 'to virtual machines of cluster via SSH. You can export ' 'your id_rsa.pub public key to OpenStack and specify its ' @@ -119,18 +119,18 @@ COMMON_CONFIG_OPTS = [ 'automatically, using nova client.'), cfg.StrOpt('FLOATING_IP_POOL', default=None, - help='Pool name for floating IPs. If Savanna uses Nova ' + help='Pool name for floating IPs. If Sahara uses Nova ' 'management network and auto assignment of IPs was ' 'enabled then you should leave default value of this ' 'parameter. If auto assignment was not enabled, then you ' 'should specify value (floating IP pool name) of this ' - 'parameter. If Savanna uses Neutron management network, ' + 'parameter. If Sahara uses Neutron management network, ' 'then you should always specify value (floating IP pool ' 'name) of this parameter.'), cfg.BoolOpt('NEUTRON_ENABLED', default=False, - help='If Savanna uses Nova management network, then you ' - 'should leave default value of this flag. If Savanna ' + help='If Sahara uses Nova management network, then you ' + 'should leave default value of this flag. If Sahara ' 'uses Neutron management network, then you should set ' 'this flag to True and specify values of the following ' 'parameters: FLOATING_IP_POOL and ' @@ -430,7 +430,7 @@ class ITConfig: register_config(cfg.CONF, IDH_CONFIG_GROUP, IDH_CONFIG_OPTS) cfg.CONF( - [], project='Savanna_integration_tests', + [], project='Sahara_integration_tests', default_config_files=config_files ) diff --git a/sahara/tests/integration/configs/itest.conf.sample b/sahara/tests/integration/configs/itest.conf.sample index 9aa505f2bd..01fd11faeb 100644 --- a/sahara/tests/integration/configs/itest.conf.sample +++ b/sahara/tests/integration/configs/itest.conf.sample @@ -4,9 +4,9 @@ OS_USERNAME = 'admin' OS_PASSWORD = 'admin' OS_TENANT_NAME = 'admin' OS_AUTH_URL = 'http://127.0.0.1:5000/v2.0' -SAVANNA_HOST = '127.0.0.1' +SAHARA_HOST = '127.0.0.1' FLAVOR_ID = 2 -USER_KEYPAIR_ID = 'savanna-key-pair' +USER_KEYPAIR_ID = 'sahara-key-pair' PATH_TO_SSH_KEY = '/home/ubuntu/.ssh/id_rsa' FLOATING_IP_POOL = 'net04_ext' NEUTRON_ENABLED = True @@ -14,7 +14,7 @@ INTERNAL_NEUTRON_NETWORK = 'net04' [VANILLA] -IMAGE_NAME = 'savanna-vanilla-image' +IMAGE_NAME = 'sahara-vanilla-image' SKIP_CLUSTER_CONFIG_TEST = True [HDP] diff --git a/sahara/tests/integration/configs/itest.conf.sample-full b/sahara/tests/integration/configs/itest.conf.sample-full index 9223a64fd4..bc56520e4e 100644 --- a/sahara/tests/integration/configs/itest.conf.sample-full +++ b/sahara/tests/integration/configs/itest.conf.sample-full @@ -20,14 +20,14 @@ #SWIFT_AUTH_VERSION = 2 -# Host for Savanna API (string value) -#SAVANNA_HOST = '127.0.0.1' +# Host for Sahara API (string value) +#SAHARA_HOST = '127.0.0.1' -# Port for Savanna API (integer value) -#SAVANNA_PORT = '8386' +# Port for Sahara API (integer value) +#SAHARA_PORT = '8386' -# Api version for Savanna (string value) -#SAVANNA_API_VERSION = '1.1' +# Api version for Sahara (string value) +#SAHARA_API_VERSION = '1.1' # OpenStack flavor ID for virtual machines. If you leave default value of this @@ -58,7 +58,7 @@ #CLUSTER_NAME = 'test-cluster' -# OpenStack key pair ID of your SSH public key. Savanna transfers this key to +# OpenStack key pair ID of your SSH public key. Sahara transfers this key to # cluster nodes for access of users to virtual machines of cluster via SSH. # You can export your id_rsa.pub public key to OpenStack and specify its key # pair ID in configuration file of tests. If you already have key pair in @@ -70,7 +70,7 @@ # automatically. Also to key pair ID will be added little ID (8 characters # (letters and/or digits)) for its uniqueness. In the end of tests key pair # will be deleted (string value) -#USER_KEYPAIR_ID = 'savanna-i-test-key-pair' +#USER_KEYPAIR_ID = 'sahara-i-test-key-pair' # Path to id_rsa key which is used with tests for remote command execution. # If you specify wrong path to key then you will have the error "Private key @@ -80,17 +80,17 @@ #PATH_TO_SSH_KEY = -# Pool name for floating IPs. If Savanna uses Nova management network and auto +# Pool name for floating IPs. If Sahara uses Nova management network and auto # assignment of IPs was enabled then you should leave default value of this # parameter. If auto assignment was not enabled then you should specify value -# (floating IP pool name) of this parameter. If Savanna uses Neutron management +# (floating IP pool name) of this parameter. If Sahara uses Neutron management # network then you should always specify value (floating IP pool name) of this # parameter (string value) #FLOATING_IP_POOL = -# If Savanna uses Nova management network then you should leave default value -# of this flag. If Savanna uses Neutron management network then you should set +# If Sahara uses Nova management network then you should leave default value +# of this flag. If Sahara uses Neutron management network then you should set # this flag to True and specify values of the following parameters: # FLOATING_IP_POOL and INTERNAL_NEUTRON_NETWORK (boolean value) #NEUTRON_ENABLED = False @@ -102,7 +102,7 @@ # This is a debugging aid for instances when errors are logged # on the cluster nodes but the cause of the failure is not # evident from the integration test logs, ie an Oozie exception. -# It is intended for use on local hosts, not savanna-ci. +# It is intended for use on local hosts, not the official ci host. #RETAIN_CLUSTER_AFTER_TEST = False [VANILLA] diff --git a/sahara/tests/integration/tests/base.py b/sahara/tests/integration/tests/base.py index 64cb8900ae..f72a7e7815 100644 --- a/sahara/tests/integration/tests/base.py +++ b/sahara/tests/integration/tests/base.py @@ -60,19 +60,19 @@ class ITestCase(unittest2.TestCase): self.idh_config = cfg.ITConfig().idh_config telnetlib.Telnet( - self.common_config.SAVANNA_HOST, self.common_config.SAVANNA_PORT + self.common_config.SAHARA_HOST, self.common_config.SAHARA_PORT ) self.sahara = savanna_client.Client( - self.common_config.SAVANNA_API_VERSION, + self.common_config.SAHARA_API_VERSION, username=self.common_config.OS_USERNAME, api_key=self.common_config.OS_PASSWORD, project_name=self.common_config.OS_TENANT_NAME, auth_url=self.common_config.OS_AUTH_URL, savanna_url='http://%s:%s/v%s/%s' % ( - self.common_config.SAVANNA_HOST, - self.common_config.SAVANNA_PORT, - self.common_config.SAVANNA_API_VERSION, + self.common_config.SAHARA_HOST, + self.common_config.SAHARA_PORT, + self.common_config.SAHARA_API_VERSION, self.common_config.OS_TENANT_ID )) diff --git a/sahara/tests/unit/db/migration/test_migrations_base.py b/sahara/tests/unit/db/migration/test_migrations_base.py index a21f651a1d..0568a9d0f6 100644 --- a/sahara/tests/unit/db/migration/test_migrations_base.py +++ b/sahara/tests/unit/db/migration/test_migrations_base.py @@ -45,7 +45,7 @@ from sahara.openstack.common import processutils LOG = logging.getLogger(__name__) CONF = cfg.CONF -synchronized = lockutils.synchronized_with_prefix('savanna-') +synchronized = lockutils.synchronized_with_prefix('sahara-') def _get_connect_string(backend, user, passwd, database): @@ -78,14 +78,14 @@ def _is_backend_avail(backend, user, passwd, database): def _have_mysql(user, passwd, database): - present = os.environ.get('SAVANNA_MYSQL_PRESENT') + present = os.environ.get('SAHARA_MYSQL_PRESENT') if present is None: return _is_backend_avail('mysql', user, passwd, database) return present.lower() in ('', 'true') def _have_postgresql(user, passwd, database): - present = os.environ.get('SAVANNA_TEST_POSTGRESQL_PRESENT') + present = os.environ.get('SAHARA_TEST_POSTGRESQL_PRESENT') if present is None: return _is_backend_avail('postgres', user, passwd, database) return present.lower() in ('', 'true') @@ -193,7 +193,7 @@ class BaseMigrationTestCase(unittest2.TestCase): 'alembic.ini') ) - self.ALEMBIC_CONFIG.savanna_config = CONF + self.ALEMBIC_CONFIG.sahara_config = CONF self.snake_walk = False self.downgrade = False diff --git a/sahara/tests/unit/resources/test_serialize_resources_aa.heat b/sahara/tests/unit/resources/test_serialize_resources_aa.heat index 7790b4d363..c57888b502 100644 --- a/sahara/tests/unit/resources/test_serialize_resources_aa.heat +++ b/sahara/tests/unit/resources/test_serialize_resources_aa.heat @@ -1,6 +1,6 @@ { "AWSTemplateFormatVersion" : "2010-09-09", - "Description" : "Hadoop Cluster by Savanna", + "Description" : "Hadoop Cluster by Sahara", "Resources" : { "cluster-worker-001-port" : { diff --git a/sahara/tests/unit/resources/test_serialize_resources_use_neutron.heat b/sahara/tests/unit/resources/test_serialize_resources_use_neutron.heat index 7fe9e3342d..7ccf6ab13f 100644 --- a/sahara/tests/unit/resources/test_serialize_resources_use_neutron.heat +++ b/sahara/tests/unit/resources/test_serialize_resources_use_neutron.heat @@ -1,6 +1,6 @@ { "AWSTemplateFormatVersion" : "2010-09-09", - "Description" : "Hadoop Cluster by Savanna", + "Description" : "Hadoop Cluster by Sahara", "Resources" : { "cluster-worker-001-port" : { diff --git a/sahara/tests/unit/service/validation/test_cluster_create_validation.py b/sahara/tests/unit/service/validation/test_cluster_create_validation.py index b9344c7ba0..8fd93170ee 100644 --- a/sahara/tests/unit/service/validation/test_cluster_create_validation.py +++ b/sahara/tests/unit/service/validation/test_cluster_create_validation.py @@ -160,7 +160,7 @@ class TestClusterCreateValidation(u.ValidationTestCase): 'hadoop_version': "1.2.1", }, bad_req_i=(1, 'INVALID_REFERENCE', - "Savanna doesn't contain plugin " + "Sahara doesn't contain plugin " "with name 'wrong_plugin'") ) diff --git a/sahara/tests/unit/service/validation/test_cluster_template_create_validation.py b/sahara/tests/unit/service/validation/test_cluster_template_create_validation.py index 9baa19da1a..9a6078903c 100644 --- a/sahara/tests/unit/service/validation/test_cluster_template_create_validation.py +++ b/sahara/tests/unit/service/validation/test_cluster_template_create_validation.py @@ -208,7 +208,7 @@ class TestClusterTemplateCreateValidation(u.ValidationTestCase): 'hadoop_version': "1.2.1", }, bad_req_i=(1, 'INVALID_REFERENCE', - "Savanna doesn't contain plugin " + "Sahara doesn't contain plugin " "with name 'wrong_plugin'") ) diff --git a/sahara/tests/unit/utils/test_crypto.py b/sahara/tests/unit/utils/test_crypto.py index 2c082c5a63..6d72c46759 100644 --- a/sahara/tests/unit/utils/test_crypto.py +++ b/sahara/tests/unit/utils/test_crypto.py @@ -28,7 +28,7 @@ class CryptoTest(unittest2.TestCase): self.assertIn('-----BEGIN RSA PRIVATE KEY-----', kp[0]) self.assertIn('-----END RSA PRIVATE KEY-----', kp[0]) self.assertIn('ssh-rsa ', kp[1]) - self.assertIn('Generated by Savanna', kp[1]) + self.assertIn('Generated by Sahara', kp[1]) def test_to_paramiko_private_key(self): pk_str = c.generate_key_pair()[0] diff --git a/sahara/utils/crypto.py b/sahara/utils/crypto.py index 6ee8644ba0..3d64cea42d 100644 --- a/sahara/utils/crypto.py +++ b/sahara/utils/crypto.py @@ -40,7 +40,7 @@ def generate_key_pair(key_length=2048): '-N', '', # w/o passphrase '-t', 'rsa', # create key of rsa type '-f', keyfile, # filename of the key file - '-C', 'Generated by Savanna' # key comment + '-C', 'Generated by Sahara' # key comment ] if key_length is not None: args.extend(['-b', key_length])