Пример #1
0
def test_build_build_volumes_several(tmpdir):
    s = Service()
    c = YamlConfig()

    foo1 = tmpdir.mkdir('foo1')
    foo2 = tmpdir.mkdir('foo2')
    foo3 = tmpdir.mkdir('foo3')

    c.process_volumes_build(
        s, {'volumes': {
            'foo1': 'bar1',
            'foo2': 'bar2',
            'foo3': 'bar3',
        }}, str(tmpdir))

    assert s.volumes == [{
        'local': str(foo1),
        'remote': 'bar1'
    }, {
        'local': str(foo2),
        'remote': 'bar2'
    }, {
        'local': str(foo3),
        'remote': 'bar3'
    }]
Пример #2
0
def test_build_build_volumes_hackish_paths(path, result):
    s = Service()
    c = YamlConfig()

    c.process_volumes_build(s, {'volumes': {
        path: 'bar',
    }}, '/foo')

    assert s.volumes == [
        {'local': result, 'remote': 'bar'},
    ]
Пример #3
0
def test_build_build_volumes_basepath(tmpdir):
    s = Service()
    c = YamlConfig()

    c.process_volumes_build(s, {'volumes': {
        '.': 'bar1',
    }}, str(tmpdir))

    assert s.volumes == [
        {'local': str(tmpdir), 'remote': 'bar1'},
    ]
Пример #4
0
def test_build_build_volumes_single_file(tmpdir):
    s = Service()
    c = YamlConfig()

    tmpdir.join('nginx.conf').write('foo')

    c.process_volumes_build(s, {'volumes': {
        'nginx.conf': 'bar1',
    }}, str(tmpdir))

    assert s.volumes == [
        {'local': str(tmpdir.join('nginx.conf')), 'remote': 'bar1'},
    ]
Пример #5
0
def test_build_build_volumes_hackish_paths(path, result):
    s = Service()
    c = YamlConfig()

    c.process_volumes_build(s, {'volumes': {
        path: 'bar',
    }}, '/foo')

    assert s.volumes == [
        {
            'local': result,
            'remote': 'bar'
        },
    ]
Пример #6
0
def test_build_build_volumes_basepath(tmpdir):
    s = Service()
    c = YamlConfig()

    c.process_volumes_build(s, {'volumes': {
        '.': 'bar1',
    }}, str(tmpdir))

    assert s.volumes == [
        {
            'local': str(tmpdir),
            'remote': 'bar1'
        },
    ]
Пример #7
0
def test_build_build_volumes_single_file(tmpdir):
    s = Service()
    c = YamlConfig()

    tmpdir.join('nginx.conf').write('foo')

    c.process_volumes_build(s, {'volumes': {
        'nginx.conf': 'bar1',
    }}, str(tmpdir))

    assert s.volumes == [
        {
            'local': str(tmpdir.join('nginx.conf')),
            'remote': 'bar1'
        },
    ]
Пример #8
0
def test_build_build_volumes_several(tmpdir):
    s = Service()
    c = YamlConfig()

    foo1 = tmpdir.mkdir('foo1')
    foo2 = tmpdir.mkdir('foo2')
    foo3 = tmpdir.mkdir('foo3')

    c.process_volumes_build(s, {'volumes': {
        'foo1': 'bar1',
        'foo2': 'bar2',
        'foo3': 'bar3',
    }}, str(tmpdir))

    assert s.volumes == [
        {'local': str(foo1), 'remote': 'bar1'},
        {'local': str(foo2), 'remote': 'bar2'},
        {'local': str(foo3), 'remote': 'bar3'}
    ]
Пример #9
0
def test_build_build_volumes_none():
    s = Service()
    c = YamlConfig()

    c.process_volumes_build(s, {}, '/base/path')
    assert s.volumes == []
Пример #10
0
def test_build_build_volumes_empty():
    s = Service()
    c = YamlConfig()

    c.process_volumes_build(s, {'volumes': []}, '/base/path')
    assert s.volumes == []
Пример #11
0
def test_build_build_volumes_none():
    s = Service()
    c = YamlConfig()

    c.process_volumes_build(s, {}, '/base/path')
    assert s.volumes == []
Пример #12
0
def test_build_build_volumes_empty():
    s = Service()
    c = YamlConfig()

    c.process_volumes_build(s, {'volumes': []}, '/base/path')
    assert s.volumes == []