Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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