def test_with_default_timeout(): yaml = ''' default-timeout: 5 seconds commands: noto: {command: "true", warn-after: 15 seconds} withto: command: "true" warn-after: 15 seconds timeout: 2 hours ''' parsed = read_configuration(yaml) expected = { 'commands': { 'noto': { 'command': 'true', 'warn-after': '15 seconds', 'timeout': 5 }, 'withto': { 'command': 'true', 'warn-after': '15 seconds', 'timeout': 7200, }, } } eq_(expected, parsed)
def test_memory_read_conf_human(): yaml = ''' commands: t: {command: "true", memory-limit: '50M'} ''' parsed = read_configuration(yaml) expected = { 'commands': { 't': { 'command': 'true', 'memory-limit': '50M', } } } eq_(parsed, expected)
def test_just_commands(): yaml = ''' commands: t: {command: "true", warn-after: 15 seconds} ''' parsed = read_configuration(yaml) expected = { 'commands': { 't': { 'command': 'true', 'warn-after': '15 seconds', } } } assert parsed == expected, parsed
def test_memory_read_conf_int(): yaml = ''' commands: t: {command: "true", memory-limit: 50000000} ''' parsed = read_configuration(yaml) expected = { 'commands': { 't': { 'command': 'exec true', 'memory-limit': 50000000, } } } eq_(parsed, expected)
def test_with_overrides(): yaml = ''' overrides: - match: ".*/t" warn-after: "45 seconds" commands: t: {command: "true", warn-after: 15 seconds} ''' parsed = read_configuration(yaml) expected = { 'commands': { 't': { 'command': 'true', 'warn-after': '45 seconds', } } } assert parsed == expected, parsed