-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use docker networks and aliases instead links in tests #352
Conversation
tests/docker_cluster.py
Outdated
@@ -211,7 +211,6 @@ def _create_and_start_containers(self, master_image, slave_image=None, cmd=None, | |||
self._get_network().connect(self.master) | |||
container = self.client.containers.get(self.master) | |||
container.start() | |||
self._add_hostnames_to_slaves() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could explain a bit why it is no longer needed in the commit message
tests/docker_cluster.py
Outdated
try: | ||
self._get_network().remove() | ||
except NotFound: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is so? Maybe a warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is not need. Will remove.
tests/docker_cluster.py
Outdated
@@ -206,8 +223,14 @@ def _create_container(self, image, container_name, hostname, cmd, **kwargs): | |||
volumes={master_mount_dir: {'bind': self.mount_dir, 'mode': 'rw'}}, | |||
command=cmd, | |||
mem_limit='2g', | |||
network=None, | |||
# network=self._network_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
tests/docker_cluster.py
Outdated
**kwargs) | ||
|
||
self._get_network().connect( | ||
container_name, | ||
aliases=[hostname.split('-')[0]]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you use split
here -
? How hostname
look like?
tests/docker_cluster.py
Outdated
**kwargs) | ||
|
||
self._get_network().connect(self.master) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
master should be already connected, see line 204 where you call _create_container
tests/product/base_product_case.py
Outdated
# all possible error messages one might encounter when trying to perform an action when a | ||
# node is not accessible. The variety in error messages comes from differences in the OS. | ||
down_node_connection_string = r'(\nWarning: (\[%(host)s\] )?Low level ' \ | ||
network_unreachable = r'(\nWarning: (\[%(host)s\] )?Low level ' \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this one is still valid once you ported tests to use network? I thought only one of these two errors should be expected.
Also make sure travis is passing. Other than that you did a great job! |
Docker networks provide name resolution automatically so we do not need to hack around /etc/hosts anymore.
As we are using network instead of links now, shuting down container results in getting `Name lookup failed for ...` error on other ones when trying to access the shut down one. Augmenting assertion to follow that.
No description provided.