示例#1
0
def test_generate_config_volumes():

    redis = flexmock()
    redis.should_receive('hgetall').and_return([])

    fake_inject({txredisapi.Connection: redis})

    s = Service()
    s.name = 'my_service'
    s.volumes = [{
        'local': '/base/path/foo1',
        'remote': '/bar1'
    }, {
        'local': '/base/path/foo2',
        'remote': '/bar2'
    }, {
        'local': '/base/path/foo3',
        'remote': '/bar3'
    }]

    config = yield s._generate_config('foo')
    assert config == {
        "Hostname": 'my_service',
        "Image": 'foo',

        # Volumes are not passed as of Docker 1.6 version
        # "Volumes": {
        #     "/bar1": {},
        #     "/bar2": {},
        #     "/bar3": {},
        # }
    }
示例#2
0
def test_generate_config_volumes():

    redis = flexmock()
    redis.should_receive('hgetall').and_return([])

    fake_inject({
        txredisapi.Connection: redis
    })

    s = Service()
    s.name = 'my_service'
    s.volumes = [
        {'local': '/base/path/foo1', 'remote': '/bar1'},
        {'local': '/base/path/foo2', 'remote': '/bar2'},
        {'local': '/base/path/foo3', 'remote': '/bar3'}
    ]

    config = yield s._generate_config('foo')
    assert config == {
        "Hostname": 'my_service',
        "Image": 'foo',

        # Volumes are not passed as of Docker 1.6 version
        # "Volumes": {
        #     "/bar1": {},
        #     "/bar2": {},
        #     "/bar3": {},
        # }
    }
示例#3
0
def test_generate_config():

    redis = flexmock()
    redis.should_receive('hgetall').and_return([])

    fake_inject({txredisapi.Connection: redis})

    s = Service()
    s.name = 'my_service'

    config = yield s._generate_config('foo')

    assert config == {"Hostname": 'my_service', "Image": 'foo'}
示例#4
0
def test_generate_config_env():

    redis = flexmock()
    redis.should_receive('hgetall').and_return({})

    fake_inject({txredisapi.Connection: redis})

    s = Service()
    s.name = 'my_service'
    s.env = {'FOO': 'bar', 'BAZ': 'foo'}

    config = yield s._generate_config('foo')
    assert config == {
        "Hostname": 'my_service',
        "Image": 'foo',
        "Env": ['FOO=bar', 'BAZ=foo']
    }
示例#5
0
def test_generate_config():

    redis = flexmock()
    redis.should_receive('hgetall').and_return([])

    fake_inject({
        txredisapi.Connection: redis
    })

    s = Service()
    s.name = 'my_service'

    config = yield s._generate_config('foo')

    assert config == {
        "Hostname": 'my_service',
        "Image": 'foo'
    }
示例#6
0
def test_generate_config_env():

    redis = flexmock()
    redis.should_receive('hgetall').and_return({})

    fake_inject({
        txredisapi.Connection: redis
    })

    s = Service()
    s.name = 'my_service'
    s.env = {'FOO': 'bar', 'BAZ': 'foo'}

    config = yield s._generate_config('foo')
    assert config == {
        "Hostname": 'my_service',
        "Image": 'foo',
        "Env": ['FOO=bar', 'BAZ=foo']
    }