def test_convert_to_standard_unit__mixed_units(): # authentication_timeout is measured in seconds with assert_raises(ValueError) as context: convert_to_standard_unit('authentication_timeout', '1kB') assert_contains(context.exception.message, '1kB') assert_contains(context.exception.message, 'TimeInMilliseconds') assert_contains(context.exception.message, ' (authentication_timeout)')
def test_convert_to_standard_unit__mixed_units(): # authentication_timeout is measured in seconds with assert_raises(ValueError) as context: convert_to_standard_unit('authentication_timeout', '1kB') assert_contains(context.exception.message, '1kB') assert_contains(context.exception.message, 'TimeInMilliseconds') assert_contains(context.exception.message, ' (authentication_timeout)')
def format_param_for_terraform(param_name, param_value): return { 'name': param_name, 'value': '' if param_value is None else postgresql_units.convert_to_standard_unit(param_name, param_value), # Anything listed as "dynamic" in # https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html # will be applied *immediately*, ignoring this flag. See: # https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithParamGroups.html 'apply_method': 'pending-reboot' }
def format_param_for_terraform(param_name, param_value): return { 'name': param_name, 'value': postgresql_units.convert_to_standard_unit(param_name, param_value), # Anything listed as "dynamic" in # https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.PostgreSQL.CommonDBATasks.html # will be applied *immediately*, ignoring this flag. See: # https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithParamGroups.html 'apply_method': 'pending-reboot' }
def test_convert_to_standard_unit__bytes(): # effective_cache_size is measured in 8kB blocks # 11520MB = 11520 * 1024 / 8 "8kB blocks" = 1474560 "8kB blocks" assert_equal(convert_to_standard_unit('effective_cache_size', '11520MB'), 1474560)
def test_convert_to_standard_unit__time(): # authentication_timeout is measured in seconds assert_equal(convert_to_standard_unit('authentication_timeout', '1m'), 60)
def test_convert_to_standard_unit__bytes(): # effective_cache_size is measured in 8kB blocks # 11520MB = 11520 * 1024 / 8 "8kB blocks" = 1474560 "8kB blocks" assert_equal(convert_to_standard_unit('effective_cache_size', '11520MB'), 1474560)
def test_convert_to_standard_unit__time(): # authentication_timeout is measured in seconds assert_equal(convert_to_standard_unit('authentication_timeout', '1m'), 60)