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
def create_services(self): """ return service tasks. :returns: string """ services = self.stack.get('services') if self.stack.get('logging') is True: services = add_logging_services(services, self.is_remote) target = 'ec2' if self.is_remote else 'local' linked_services = link_services(services, target) services_tasks = "" for service in linked_services: if service.get('migrations') is not None: services_tasks += self.create_migration(service) services_tasks += apply_template('service.yml', service=service, conf=self.config) return services_tasks
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"