Skip to content
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

Closed
wants to merge 5 commits into from
Closed

Use docker networks and aliases instead links in tests #352

wants to merge 5 commits into from

Conversation

losipiuk
Copy link
Contributor

@losipiuk losipiuk commented Dec 8, 2017

No description provided.

@@ -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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

Copy link
Contributor

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

try:
self._get_network().remove()
except NotFound:
pass
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@@ -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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

**kwargs)

self._get_network().connect(
container_name,
aliases=[hostname.split('-')[0]])
Copy link
Contributor

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?

**kwargs)

self._get_network().connect(self.master)
Copy link
Contributor

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

# 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 ' \
Copy link
Contributor

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.

@kokosing
Copy link
Contributor

kokosing commented Dec 8, 2017

Also make sure travis is passing. Other than that you did a great job!

@kokosing
Copy link
Contributor

kokosing commented Dec 8, 2017

Fixes #348 and #351

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.
@losipiuk losipiuk closed this Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants