def test_current_step_results(self): config = Config({ 'tssc-config': { 'write-config-as-results': { 'implementer': 'tests.helpers.sample_step_implementers.WriteConfigAsResultsStepImplementer', 'config': { 'config-1': "config-1", 'foo': "bar", } } } }) step_config = config.get_step_config('write-config-as-results') sub_step = step_config.get_sub_step( 'tests.helpers.sample_step_implementers.WriteConfigAsResultsStepImplementer' ) with TempDirectory() as test_dir: results_dir_path = os.path.join(test_dir.path, 'tssc-results') step = WriteConfigAsResultsStepImplementer( results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path='tssc-working', config=sub_step) step.run_step() results = step.current_step_results() self.assertEqual(results, { 'config-1': "config-1", 'foo': "bar", })
def test_write_working_file(self): """Test write working file""" config = Config({ 'tssc-config': { 'foo': { 'implementer': 'tests.helpers.sample_step_implementers.FooStepImplementer', 'config': {} } } }) step_config = config.get_step_config('foo') sub_step = (step_config.get_sub_step( 'tests.helpers.sample_step_implementers.FooStepImplementer')) with TempDirectory() as test_dir: results_dir_path = os.path.join(test_dir.path, 'tssc-results') working_dir_path = os.path.join(test_dir.path, 'tssc-working') step = FooStepImplementer(results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path=working_dir_path, config=sub_step) step.write_working_file('test-working-file', b'hello world') working_file_path = os.path.join(working_dir_path, 'foo', 'test-working-file') with open(working_file_path, 'r') as working_file: self.assertEqual(working_file.read(), 'hello world')
def test_write_working_file_touch(self): config = Config({ 'tssc-config': { 'foo': { 'implementer': 'tests.helpers.sample_step_implementers.FooStepImplementer', 'config': {} } } }) step_config = config.get_step_config('foo') sub_step = step_config.get_sub_step( 'tests.helpers.sample_step_implementers.FooStepImplementer') with TempDirectory() as test_dir: results_dir_path = os.path.join(test_dir.path, 'tssc-results') working_dir_path = os.path.join(test_dir.path, 'tssc-working') step = FooStepImplementer(results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path=working_dir_path, config=sub_step) step.write_working_file('test.json') working_file_path = os.path.join(working_dir_path, 'foo/test.json') self.assertTrue(os.path.exists(working_file_path)) with open(working_file_path, 'r') as working_file: self.assertEqual(working_file.read(), '')
def test_get_config_value(self): config = Config({ 'tssc-config': { 'foo': { 'implementer': 'tests.helpers.sample_step_implementers.FooStepImplementer', 'config': { 'test': 'hello world' } } } }) step_config = config.get_step_config('foo') sub_step = step_config.get_sub_step( 'tests.helpers.sample_step_implementers.FooStepImplementer') with TempDirectory() as test_dir: results_dir_path = os.path.join(test_dir.path, 'tssc-results') working_dir_path = os.path.join(test_dir.path, 'tssc-working') step = FooStepImplementer(results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path=working_dir_path, config=sub_step) self.assertEqual(step.get_config_value('test'), 'hello world') self.assertIsNone(step.get_config_value('does-not-exist'))
def test_global_defaults(self): tssc_config = Config({ Config.TSSC_CONFIG_KEY: { 'global-defaults': { 'test1': 'global-default-1', 'test2': 'global-default-2' }, 'step-foo': [{ 'implementer': 'foo1', 'config': { 'test1': 'foo' } }] } }) step_config = tssc_config.get_step_config('step-foo') sub_step = step_config.get_sub_step('foo1') self.assertEqual( sub_step.global_defaults, { 'test1': ConfigValue('global-default-1', None, ["tssc-config", "global-defaults", "test1"]), 'test2': ConfigValue('global-default-2', None, ["tssc-config", "global-defaults", "test2"]) })
def test_get_step_results(self): config = Config({ 'tssc-config': { 'write-config-as-results': { 'implementer': 'tests.helpers.sample_step_implementers.WriteConfigAsResultsStepImplementer', 'config': { 'config-1': "config-1", 'foo': "bar", } }, 'foo': { 'implementer': 'tests.helpers.sample_step_implementers.FooStepImplementer', 'config': {} } } }) write_config_as_results_step_config = config.get_step_config( 'write-config-as-results') write_config_as_results_step_config_sub_step = write_config_as_results_step_config.get_sub_step( 'tests.helpers.sample_step_implementers.WriteConfigAsResultsStepImplementer' ) foo_step_config = config.get_step_config('foo') foo_sub_step = foo_step_config.get_sub_step( 'tests.helpers.sample_step_implementers.FooStepImplementer') with TempDirectory() as test_dir: results_dir_path = os.path.join(test_dir.path, 'tssc-results') write_config_step = WriteConfigAsResultsStepImplementer( results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path='tssc-working', config=write_config_as_results_step_config_sub_step) write_config_step.run_step() # verify step can return it's own results results_from_same_step = write_config_step.get_step_results( 'write-config-as-results') self.assertEqual(results_from_same_step, { 'config-1': "config-1", 'foo': "bar", }) # verify step can return results from a previous step foo_step = FooStepImplementer(results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path='tssc-working', config=foo_sub_step) results_from_diff_step = foo_step.get_step_results( 'write-config-as-results') self.assertEqual(results_from_diff_step, { 'config-1': "config-1", 'foo': "bar", })
def test_create_working_dir_sub_dir(self): """Test create sub directory in working directory""" config = Config({ 'tssc-config': { 'foo': { 'implementer': 'tests.helpers.sample_step_implementers.FooStepImplementer', 'config': { 'test': 'hello world', 'env-config-override-key': 'override-me', 'username': '******', 'password': '******' }, 'environment-config': { 'SAMPLE-ENV-1': { 'env-config-override-key': 'step env config - env 1 value - 1' }, 'SAMPLE-ENV-2': { 'env-config-override-key': 'step env config - env 2 value - 1' } }, } } }) step_config = config.get_step_config('foo') sub_step = (step_config.get_sub_step( 'tests.helpers.sample_step_implementers.FooStepImplementer')) with TempDirectory() as test_dir: results_dir_path = os.path.join(test_dir.path, 'tssc-results') working_dir_path = os.path.join(test_dir.path, 'tssc-working') new_dir_path = os.path.join(working_dir_path, 'foo', 'test') step = FooStepImplementer(results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path=working_dir_path, config=sub_step, environment='SAMPLE-ENV-1') self.assertFalse( os.path.isdir(new_dir_path), msg='Sub directory in working directory should not exist yet') new_dir_created_path = step.create_working_dir_sub_dir('test') self.assertTrue(new_dir_created_path == new_dir_path, msg='Sub directory created in the wrong place') self.assertTrue( os.path.isdir(new_dir_path), msg='Sub directory in working directory should exist')
def test_has_config_value(self): """Test has config value""" config = Config({ 'tssc-config': { 'foo': { 'implementer': 'tests.helpers.sample_step_implementers.FooStepImplementer', 'config': { 'test': 'hello world', 'env-config-override-key': 'override-me', 'username': '******', 'password': '******' }, 'environment-config': { 'SAMPLE-ENV-1': { 'env-config-override-key': 'step env config - env 1 value - 1' }, 'SAMPLE-ENV-2': { 'env-config-override-key': 'step env config - env 2 value - 1' } }, } } }) step_config = config.get_step_config('foo') sub_step = (step_config.get_sub_step( 'tests.helpers.sample_step_implementers.FooStepImplementer')) with TempDirectory() as test_dir: results_dir_path = os.path.join(test_dir.path, 'tssc-results') working_dir_path = os.path.join(test_dir.path, 'tssc-working') step = FooStepImplementer(results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path=working_dir_path, config=sub_step, environment='SAMPLE-ENV-1') self.assertFalse(step.has_config_value('bar')) self.assertFalse(step.has_config_value(['bar'])) self.assertFalse(step.has_config_value(['username', 'foo'], False)) self.assertTrue(step.has_config_value(['username', 'foo'], True)) self.assertTrue( step.has_config_value(['username', 'password'], False)) self.assertTrue( step.has_config_value(['username', 'password'], True))
def test_step_name(self): tssc_config = Config({ Config.TSSC_CONFIG_KEY: { 'step-foo': [{ 'implementer': 'foo1', 'config': { 'test1': 'foo' } }] } }) step_config = tssc_config.get_step_config('step-foo') sub_step = step_config.get_sub_step('foo1') self.assertEqual(sub_step.step_name, 'step-foo')
def test_merge_sub_step_config_duplicate_sub_step_environment_config_keys( self): with self.assertRaisesRegex( ValueError, r"Error merging new sub step environment configuration into existing sub step environment configuration for sub step \(foo1\) of step \(step-foo\): Conflict at env1.dup-key" ): Config([{ Config.TSSC_CONFIG_KEY: { 'step-foo': [{ 'implementer': 'foo1', 'config': { 'test1': 'foo' }, 'environment-config': { 'env1': { 'dup-key': 'value1' } } }] } }, { Config.TSSC_CONFIG_KEY: { 'step-foo': [{ 'implementer': 'foo1', 'config': { 'test2': 'bar' }, 'environment-config': { 'env1': { 'dup-key': 'value2' } } }] } }])
def test_merge_sub_step_config_duplicate_sub_step_keys(self): with self.assertRaisesRegex( ValueError, r"Error merging new sub step configuration into existing sub step configuration for sub step \(foo1\) of step \(step-foo\): Conflict at test1" ): Config([{ Config.TSSC_CONFIG_KEY: { 'step-foo': [ { 'implementer': 'foo1', 'config': { 'test1': 'foo' } }, ] } }, { Config.TSSC_CONFIG_KEY: { 'step-foo': [ { 'implementer': 'foo1', 'config': { 'test1': 'bar' } }, ] } }])
def test_parent_config(self): tssc_config = Config({ Config.TSSC_CONFIG_KEY: { 'step-foo': [ { 'implementer': 'foo1', 'config': { 'test1': 'foo' } } ] } }) step_config = tssc_config.get_step_config('step-foo') self.assertEqual(step_config.parent_config, tssc_config)
def test_get_sub_step_non_existing_sub_step_name(self): tssc_config = Config([ { Config.TSSC_CONFIG_KEY: { 'step-foo': [ { 'implementer': 'foo1', 'config': { 'test1': 'foo' } } ] } } ]) step_config = tssc_config.get_step_config('step-foo') self.assertIsNone(step_config.get_sub_step('does-not-exist'))
def test_add_or_update_sub_step_config_exising_sub_step(self): tssc_config = Config([ { Config.TSSC_CONFIG_KEY: { 'step-foo': [ { 'implementer': 'foo1', 'config': { 'test1': 'foo' } } ] } }, { Config.TSSC_CONFIG_KEY: { 'step-foo': [ { 'implementer': 'foo1', 'config': { 'test2': 'foo' } } ] } }, ]) step_config = tssc_config.get_step_config('step-foo') self.assertEqual(len(step_config.sub_steps), 1) self.assertEqual( ConfigValue.convert_leaves_to_values( step_config.get_sub_step('foo1').sub_step_config ), { 'test1': 'foo', 'test2': 'foo' } )
def test_get_config_value_with_env(self): """Test get config value with env""" config = Config({ 'tssc-config': { 'foo': { 'implementer': 'tests.helpers.sample_step_implementers.FooStepImplementer', 'config': { 'test': 'hello world', 'env-config-override-key': 'override-me' }, 'environment-config': { 'SAMPLE-ENV-1': { 'env-config-override-key': 'step env config - env 1 value - 1' }, 'SAMPLE-ENV-2': { 'env-config-override-key': 'step env config - env 2 value - 1' } }, } } }) step_config = config.get_step_config('foo') sub_step = (step_config.get_sub_step( 'tests.helpers.sample_step_implementers.FooStepImplementer')) with TempDirectory() as test_dir: results_dir_path = os.path.join(test_dir.path, 'tssc-results') working_dir_path = os.path.join(test_dir.path, 'tssc-working') step = FooStepImplementer(results_dir_path=results_dir_path, results_file_name='tssc-results.yml', work_dir_path=working_dir_path, config=sub_step, environment='SAMPLE-ENV-1') self.assertEqual(step.get_config_value('test'), 'hello world') self.assertIsNone(step.get_config_value('does-not-exist')) self.assertEqual(step.get_config_value('env-config-override-key'), 'step env config - env 1 value - 1')
def test_init_with_config_object(self): config = { Config.TSSC_CONFIG_KEY: { 'step-foo': { 'implementer': 'foo' } } } tssc_config = Config(config) factory = TSSCFactory(tssc_config, 'results.yml') self.assertEqual(factory.config, tssc_config)
def test_empty_constructor_params(self): """Test empty constructor params""" implementer = 'tests.helpers.sample_step_implementers.WriteConfigAsResultsStepImplementer' config = Config({ 'tssc-config': { 'write-config-as-results': { 'implementer': implementer } } }) step_config = config.get_step_config('write-config-as-results') sub_step = step_config.get_sub_step(implementer) step = WriteConfigAsResultsStepImplementer(results_dir_path='', results_file_name='', work_dir_path='', config=sub_step) self.assertEqual(step.step_environment_config, {}) self.assertEqual(step.step_config, {}) self.assertEqual(step.global_config_defaults, {}) self.assertEqual(step.global_environment_config_defaults, {})
def test_global_environment_defaults(self): tssc_config = Config({ Config.TSSC_CONFIG_KEY: { 'global-environment-defaults': { 'env1': { 'test1': 'global-env1-default-1', 'test2': 'global-env1-default-2' }, 'env2': { 'test1': 'global-env2-default-1', 'test2': 'global-env2-default-2' } }, 'step-foo': [{ 'implementer': 'foo1', 'config': { 'test1': 'foo' } }] } }) step_config = tssc_config.get_step_config('step-foo') sub_step = step_config.get_sub_step('foo1') self.assertEqual( ConfigValue.convert_leaves_to_values( sub_step.get_global_environment_defaults('env1')), { 'environment-name': 'env1', 'test1': 'global-env1-default-1', 'test2': 'global-env1-default-2' }) self.assertEqual( ConfigValue.convert_leaves_to_values( sub_step.get_global_environment_defaults('env2')), { 'environment-name': 'env2', 'test1': 'global-env2-default-1', 'test2': 'global-env2-default-2' })
def test_get_sub_step_env_config(self): tssc_config = Config({ Config.TSSC_CONFIG_KEY: { 'step-foo': [{ 'implementer': 'foo1', 'config': { 'test1': 'foo' }, 'environment-config': { 'env1': { 'test2': 'bar' } } }] } }) step_config = tssc_config.get_step_config('step-foo') sub_step = step_config.get_sub_step('foo1') self.assertEqual( ConfigValue.convert_leaves_to_values( sub_step.get_sub_step_env_config('env1')), {'test2': 'bar'})
def test_get_copy_of_runtime_step_config_default_global_defaults_global_env_defaults_sub_step_config_sub_step_env_config_step_config_overrides( self): tssc_config = Config({ Config.TSSC_CONFIG_KEY: { 'global-defaults': { 'global-default-unique-0': 'global-default', 'global-default-override-by-global-env-default-0': 'global-default-override-me', 'global-default-override-by-step-config-0': 'global-default-override-me', 'global-default-override-by-step-env-config-0': 'global-default-override-me', 'global-default-override-by-step-config-override-0': 'global-default-override-me', 'default-overriden-by-global-default': 'global-default', }, 'global-environment-defaults': { 'env1': { 'global-default-override-by-global-env-default-0': 'global-environment-defaults-1', 'global-env-default-env1-unique-0': 'global-environment-defaults-1', 'global-env-default-override-by-step-config': 'global-environment-defaults-1', 'default-overriden-by-global-env-default': 'global-environment-defaults-1' }, 'env2': { 'global-default-override-by-global-env-default-0': 'global-environment-defaults-2', 'global-env-default-env2-unique-0': 'global-environment-defaults-2', 'global-env-default-override-by-step-config': 'global-environment-defaults-2', 'default-overriden-by-global-env-default': 'global-environment-defaults-2' } }, 'step-foo': [{ 'implementer': 'foo1', 'config': { 'step-foo-foo1-unique-0': 'step-foo-foo1', 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-override-me', 'step-foo-foo1-override-by-step-override': 'step-foo-foo-override-me', 'global-default-override-by-step-config-0': 'step-foo-foo1', 'global-env-default-override-by-step-config': 'step-foo-foo1', 'default-overriden-by-step-config': 'step-foo-foo1' }, 'environment-config': { 'env1': { 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-env1', 'global-default-override-by-step-env-config-0': 'step-foo-foo-env1', 'step-foo-foo1-env1-unique-0': 'step-foo-foo-env1', 'step-foo-foo1-env-specific': 'step-foo-foo-env1', 'default-overriden-by-step-env-config': 'step-foo-foo-env1', }, 'env2': { 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-env2', 'global-default-override-by-step-env-config-0': 'step-foo-foo-env2', 'step-foo-foo1-env2-unique-0': 'step-foo-foo-env2', 'step-foo-foo1-env-specific': 'step-foo-foo-env2', 'default-overriden-by-step-env-config': 'step-foo-foo-env2', } } }] } }) tssc_config.set_step_config_overrides( 'step-foo', { 'global-default-override-by-step-config-override-0': 'step-foo-step-config-override', 'step-foo-foo1-override-by-step-override': 'step-foo-step-config-override', 'step-config-override-unique-0': 'step-config-override-unique', 'default-overriden-by-step-config-overrides': 'step-foo-step-config-override' }) step_config = tssc_config.get_step_config('step-foo') sub_step = step_config.get_sub_step('foo1') defaults = { 'default-unique': 'not-overriden-default', 'default-overriden-by-global-default': 'override-me', 'default-overriden-by-global-env-default': 'override-me', 'default-overriden-by-step-config': 'override-me', 'default-overriden-by-step-env-config': 'override-me', 'default-overriden-by-step-config-overrides': 'override-me' } runtime_step_config_no_given_env = sub_step.get_copy_of_runtime_step_config( None, defaults) self.assertEqual( ConfigValue.convert_leaves_to_values( runtime_step_config_no_given_env), { 'global-default-unique-0': 'global-default', 'global-default-override-by-global-env-default-0': 'global-default-override-me', 'global-default-override-by-step-config-0': 'step-foo-foo1', 'global-default-override-by-step-env-config-0': 'global-default-override-me', 'step-foo-foo1-unique-0': 'step-foo-foo1', 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-override-me', 'global-default-override-by-step-config-override-0': 'step-foo-step-config-override', 'step-foo-foo1-override-by-step-override': 'step-foo-step-config-override', 'step-config-override-unique-0': 'step-config-override-unique', 'global-env-default-override-by-step-config': 'step-foo-foo1', 'default-unique': 'not-overriden-default', 'default-overriden-by-global-default': 'global-default', 'default-overriden-by-global-env-default': 'override-me', 'default-overriden-by-step-config': 'step-foo-foo1', 'default-overriden-by-step-env-config': 'override-me', 'default-overriden-by-step-config-overrides': 'step-foo-step-config-override' }) runtime_step_config_env1 = sub_step.get_copy_of_runtime_step_config( 'env1', defaults) self.assertEqual( ConfigValue.convert_leaves_to_values(runtime_step_config_env1), { 'environment-name': 'env1', 'global-default-unique-0': 'global-default', 'global-default-override-by-global-env-default-0': 'global-environment-defaults-1', 'global-default-override-by-step-config-0': 'step-foo-foo1', 'global-default-override-by-step-env-config-0': 'step-foo-foo-env1', 'step-foo-foo1-unique-0': 'step-foo-foo1', 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-env1', 'global-default-override-by-step-config-override-0': 'step-foo-step-config-override', 'step-foo-foo1-override-by-step-override': 'step-foo-step-config-override', 'step-config-override-unique-0': 'step-config-override-unique', 'global-env-default-override-by-step-config': 'step-foo-foo1', 'global-env-default-env1-unique-0': 'global-environment-defaults-1', 'step-foo-foo1-env1-unique-0': 'step-foo-foo-env1', 'step-foo-foo1-env-specific': 'step-foo-foo-env1', 'default-unique': 'not-overriden-default', 'default-overriden-by-global-default': 'global-default', 'default-overriden-by-global-env-default': 'global-environment-defaults-1', 'default-overriden-by-step-config': 'step-foo-foo1', 'default-overriden-by-step-env-config': 'step-foo-foo-env1', 'default-overriden-by-step-config-overrides': 'step-foo-step-config-override' }) runtime_step_config_env2 = sub_step.get_copy_of_runtime_step_config( 'env2', defaults) self.assertEqual( ConfigValue.convert_leaves_to_values(runtime_step_config_env2), { 'environment-name': 'env2', 'global-default-unique-0': 'global-default', 'global-default-override-by-global-env-default-0': 'global-environment-defaults-2', 'global-default-override-by-step-config-0': 'step-foo-foo1', 'global-default-override-by-step-env-config-0': 'step-foo-foo-env2', 'step-foo-foo1-unique-0': 'step-foo-foo1', 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-env2', 'global-default-override-by-step-config-override-0': 'step-foo-step-config-override', 'step-foo-foo1-override-by-step-override': 'step-foo-step-config-override', 'step-config-override-unique-0': 'step-config-override-unique', 'global-env-default-override-by-step-config': 'step-foo-foo1', 'global-env-default-env2-unique-0': 'global-environment-defaults-2', 'step-foo-foo1-env2-unique-0': 'step-foo-foo-env2', 'step-foo-foo1-env-specific': 'step-foo-foo-env2', 'default-unique': 'not-overriden-default', 'default-overriden-by-global-default': 'global-default', 'default-overriden-by-global-env-default': 'global-environment-defaults-2', 'default-overriden-by-step-config': 'step-foo-foo1', 'default-overriden-by-step-env-config': 'step-foo-foo-env2', 'default-overriden-by-step-config-overrides': 'step-foo-step-config-override' })
def test_get_config_value(self): tssc_config = Config({ Config.TSSC_CONFIG_KEY: { 'global-defaults': { 'global-default-unique-0': 'global-default', 'global-default-override-by-global-env-default-0': 'global-default-override-me', 'global-default-override-by-step-config-0': 'global-default-override-me', 'global-default-override-by-step-env-config-0': 'global-default-override-me', 'global-default-override-by-step-config-override-0': 'global-default-override-me' }, 'global-environment-defaults': { 'env1': { 'global-default-override-by-global-env-default-0': 'global-environment-defaults-1', 'global-env-default-env1-unique-0': 'global-environment-defaults-1', 'global-env-default-override-by-step-config': 'global-environment-defaults-1' }, 'env2': { 'global-default-override-by-global-env-default-0': 'global-environment-defaults-2', 'global-env-default-env2-unique-0': 'global-environment-defaults-2', 'global-env-default-override-by-step-config': 'global-environment-defaults-1' } }, 'step-foo': [{ 'implementer': 'foo1', 'config': { 'step-foo-foo1-unique-0': 'step-foo-foo1', 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-override-me', 'step-foo-foo1-override-by-step-override': 'step-foo-foo-override-me', 'global-default-override-by-step-config-0': 'step-foo-foo1', 'global-env-default-override-by-step-config': 'step-foo-foo1' }, 'environment-config': { 'env1': { 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-env1', 'global-default-override-by-step-env-config-0': 'step-foo-foo-env1', 'step-foo-foo1-env1-unique-0': 'step-foo-foo-env1', 'step-foo-foo1-env-specific': 'step-foo-foo-env1' }, 'env2': { 'step-foo-foo1-override-by-step-env-config': 'step-foo-foo-env2', 'global-default-override-by-step-env-config-0': 'step-foo-foo-env2', 'step-foo-foo1-env2-unique-0': 'step-foo-foo-env2', 'step-foo-foo1-env-specific': 'step-foo-foo-env2' } } }] } }) tssc_config.set_step_config_overrides( 'step-foo', { 'global-default-override-by-step-config-override-0': 'step-foo-step-config-override', 'step-foo-foo1-override-by-step-override': 'step-foo-step-config-override', 'step-config-override-unique-0': 'step-config-override-unique' }) step_config = tssc_config.get_step_config('step-foo') sub_step = step_config.get_sub_step('foo1') self.assertEqual(sub_step.get_config_value('global-default-unique-0'), "global-default") self.assertEqual( sub_step.get_config_value( 'global-default-override-by-global-env-default-0'), "global-default-override-me") self.assertEqual( sub_step.get_config_value( 'global-default-override-by-global-env-default-0', 'env1'), "global-environment-defaults-1") self.assertEqual( sub_step.get_config_value( 'global-default-override-by-global-env-default-0', 'env2'), "global-environment-defaults-2") self.assertEqual( sub_step.get_config_value( 'global-default-override-by-step-config-0'), "step-foo-foo1") self.assertEqual( sub_step.get_config_value( 'global-default-override-by-step-config-0', 'env1'), "step-foo-foo1") self.assertEqual(sub_step.get_config_value('step-foo-foo1-unique-0', ), "step-foo-foo1") self.assertEqual( sub_step.get_config_value('step-foo-foo1-unique-0', 'env1'), "step-foo-foo1") self.assertEqual( sub_step.get_config_value( 'step-foo-foo1-override-by-step-env-config', ), "step-foo-foo-override-me") self.assertEqual( sub_step.get_config_value( 'step-foo-foo1-override-by-step-env-config', 'env1'), "step-foo-foo-env1") self.assertEqual( sub_step.get_config_value( 'step-foo-foo1-override-by-step-env-config', 'env2'), "step-foo-foo-env2") self.assertIsNone(sub_step.get_config_value('does-not-exist'))