Created
August 1, 2016 20:06
-
-
Save remh/6663e89d710649ff8de181e8c89e3a98 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setUp(self): | |
c = Client(version='auto') | |
c.pull(REDIS_DOCKER_IMAGE) | |
self.containers = [] | |
def create_cont(name, host_port, args=None, link=None): | |
if link: | |
host_conf = c.create_host_config(port_bindings={6379: host_port}, links=[(link,link)]) | |
else: | |
host_conf = c.create_host_config(port_bindings={6379: host_port}) | |
cont = c.create_container( | |
image=REDIS_DOCKER_IMAGE, | |
name=name, | |
ports=[6379], | |
host_config=host_conf, | |
entrypoint=args | |
) | |
c.start(cont) | |
return cont | |
self.containers.append(create_cont("redis-master", 16379)) | |
self.containers.append(create_cont("redis-auth", 26379, "redis-server --requirepass datadog-is-devops-best-friend --slaveof redis-master 6379", link="redis-master")) | |
self.containers.append(create_cont("redis-slave-healthy", 36379, "redis-server --slaveof redis-master 6379", link="redis-master")) | |
self.containers.append(create_cont("redis-slave-unhealthy", 46379, "redis-server --slaveof redis-master 55555", link="redis-master")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment