Exemplo n.º 1
0
def test_direct_linking():
    with open("tests/stack-confs/direct-linking-stack-conf.yml") as stack_conf:
        stack_conf = StackConf(stack_conf)
    linked_services = linker.link_services(stack_conf.get('services'), "ec2")
    auth_plus = find_by_attr(linked_services, 'name', 'auth-plus')
    assert auth_plus.get(
        'env')["CASSANDRA_HOST"] == "{{ groups.cassandra[0] }}"
def test_link_via_env():
    stack_conf_file = "tests/stack-confs/auth-plus-linking-stack-conf.yml"
    with open(stack_conf_file) as stack_conf:
        stack_conf = StackConf(stack_conf)
    linked_services = linker.link_services(stack_conf.get('services'), "ec2")
    expected = {
        "CASSANDRA_PORT": 9042,
        "CASSANDRA_HOST": "{{ groups.haproxy[0] }}",
        "CASSANDRA_PORT_9042_TCP_ADDR": "{{ groups.haproxy[0] }}",
        "REDIS_PORT": 6379,
        "REDIS_HOST": "{{ groups.haproxy[0] }}",
        "REDIS_PORT_6379_TCP_ADDR": "{{ groups.haproxy[0] }}",
        "DEVICE_INFO_PORT": 9002,
        "DEVICE_INFO_HOST": "{{ groups.haproxy[0] }}",
        "DEVICE_INFO_PORT_9002_TCP_ADDR": "{{ groups.haproxy[0] }}"
    }
    auth_plus = find_by_attr(linked_services, 'name', 'auth-plus')
    assert auth_plus.get('env') == expected
Exemplo n.º 3
0
def test_link_via_env():
    stack_conf_file = "tests/stack-confs/auth-plus-linking-stack-conf.yml"
    with open(stack_conf_file) as stack_conf:
        stack_conf = StackConf(stack_conf)
    linked_services = linker.link_services(stack_conf.get('services'), "ec2")
    expected = {
        "CASSANDRA_PORT": 9042,
        "CASSANDRA_HOST": "{{ groups.haproxy[0] }}",
        "CASSANDRA_PORT_9042_TCP_ADDR": "{{ groups.haproxy[0] }}",
        "REDIS_PORT": 6379,
        "REDIS_HOST": "{{ groups.haproxy[0] }}",
        "REDIS_PORT_6379_TCP_ADDR": "{{ groups.haproxy[0] }}",
        "DEVICE_INFO_PORT": 9002,
        "DEVICE_INFO_HOST": "{{ groups.haproxy[0] }}",
        "DEVICE_INFO_PORT_9002_TCP_ADDR": "{{ groups.haproxy[0] }}"
    }
    auth_plus = find_by_attr(linked_services, 'name', 'auth-plus')
    assert auth_plus.get('env') == expected
def test_direct_linking():
    with open("tests/stack-confs/direct-linking-stack-conf.yml") as stack_conf:
        stack_conf = StackConf(stack_conf)
    linked_services = linker.link_services(stack_conf.get('services'), "ec2")
    auth_plus = find_by_attr(linked_services, 'name', 'auth-plus')
    assert auth_plus.get('env')["CASSANDRA_HOST"] == "{{ groups.cassandra[0] }}"
def test_link_retains_env_variables():
    with open("tests/stack-confs/direct-linking-stack-conf.yml") as stack_conf:
        stack_conf = StackConf(stack_conf)
    linker.link_services(stack_conf.get('services'), "ec2")
    auth_plus = find_by_attr(stack_conf.get('services'), 'name', 'auth-plus')
    assert auth_plus.get('env')["ENV_VAR_THAT"] == "should_still_be_here"
Exemplo n.º 6
0
def test_link_retains_env_variables():
    with open("tests/stack-confs/direct-linking-stack-conf.yml") as stack_conf:
        stack_conf = StackConf(stack_conf)
    linker.link_services(stack_conf.get('services'), "ec2")
    auth_plus = find_by_attr(stack_conf.get('services'), 'name', 'auth-plus')
    assert auth_plus.get('env')["ENV_VAR_THAT"] == "should_still_be_here"