diff --git a/lib/common_functions.rb b/lib/common_functions.rb index 4b6bde0b..7fa87c79 100644 --- a/lib/common_functions.rb +++ b/lib/common_functions.rb @@ -47,7 +47,8 @@ CLOUDY_CREDS = ["ec2_access_key", "ec2_secret_key", "aws_access_key_id", "aws_secret_access_key", - "SIMPLEDB_ACCESS_KEY", "SIMPLEDB_SECRET_KEY"] + "SIMPLEDB_ACCESS_KEY", "SIMPLEDB_SECRET_KEY", + "CLOUD1_EC2_ACCESS_KEY", "CLOUD1_EC2_SECRET_KEY"] VER_NUM = "1.6.4" diff --git a/test/tc_common_functions.rb b/test/tc_common_functions.rb index 81384d46..690fb496 100644 --- a/test/tc_common_functions.rb +++ b/test/tc_common_functions.rb @@ -102,4 +102,28 @@ def test_get_java_app_has_threadsafe CommonFunctions.ensure_app_has_threadsafe(dir, web_xml_false_threadsafe) } end + + def test_obscure_creds + creds = { + 'ec2_access_key' => 'ABCDEFG', + 'ec2_secret_key' => 'HIJKLMN', + 'CLOUD1_EC2_ACCESS_KEY' => 'OPQRSTU', + 'CLOUD1_EC2_SECRET_KEY' => 'VWXYZAB' + } + + expected = { + 'ec2_access_key' => '***DEFG', + 'ec2_secret_key' => '***KLMN', + 'CLOUD1_EC2_ACCESS_KEY' => '***RSTU', + 'CLOUD1_EC2_SECRET_KEY' => '***YZAB' + } + + actual = CommonFunctions.obscure_creds(creds) + assert_equal(expected['ec2_access_key'], actual['ec2_access_key']) + assert_equal(expected['ec2_secret_key'], actual['ec2_secret_key']) + assert_equal(expected['CLOUD1_EC2_ACCESS_KEY'], + actual['CLOUD1_EC2_ACCESS_KEY']) + assert_equal(expected['CLOUD1_EC2_SECRET_KEY'], + actual['CLOUD1_EC2_SECRET_KEY']) + end end diff --git a/test/tc_parse_args.rb b/test/tc_parse_args.rb index b70cf241..2620f93d 100644 --- a/test/tc_parse_args.rb +++ b/test/tc_parse_args.rb @@ -82,11 +82,11 @@ def test_table_flags } # Specifying a table that is accepted should return that in the result - args_2 = ['--table', 'voldemort'] + args_2 = ['--table', 'cassandra'] all_flags_2 = ['table'] expected_2 = Hash[*args_2] actual_2 = ParseArgs.get_vals_from_args(args_2, all_flags_2, @usage) - assert_equal('voldemort', actual_2['table']) + assert_equal('cassandra', actual_2['table']) # Failing to specify a table should default to a predefined table args_3 = [] @@ -136,15 +136,20 @@ def test_table_flags assert_equal(2, actual_9['replication']) # Specifying a positive integer for r or w with Voldemort should be ok - args_10 = ['--table', 'voldemort', '-r', '3'] - all_flags_10 = ['table', 'r', 'w'] - actual_10 = ParseArgs.get_vals_from_args(args_10, all_flags_10, @usage) - assert_equal(3, actual_10['voldemort_r']) - - args_11 = ['--table', 'voldemort', '-w', '3'] - all_flags_11 = ['table', 'r', 'w'] - actual_11 = ParseArgs.get_vals_from_args(args_11, all_flags_11, @usage) - assert_equal(3, actual_11['voldemort_w']) + # These tests are disabled right now since Voldemort is no longer a + # supported datastore. + # TODO(cgb): Remove these if we decide we're not going to support + # Voldemort in the future, or remove this TODO if we do support + # Voldemort again. + #args_10 = ['--table', 'voldemort', '-r', '3'] + #all_flags_10 = ['table', 'r', 'w'] + #actual_10 = ParseArgs.get_vals_from_args(args_10, all_flags_10, @usage) + #assert_equal(3, actual_10['voldemort_r']) + + #args_11 = ['--table', 'voldemort', '-w', '3'] + #all_flags_11 = ['table', 'r', 'w'] + #actual_11 = ParseArgs.get_vals_from_args(args_11, all_flags_11, @usage) + #assert_equal(3, actual_11['voldemort_w']) end def test_developer_flags