Add PERMIT_DOCKER=connected-networks#1185
Add PERMIT_DOCKER=connected-networks#1185erik-wramner merged 3 commits intodocker-mailserver:masterfrom
Conversation
|
Can you add:
|
bf10416 to
c09b178
Compare
|
@tomav I tried but I can't seem to get the tests working locally. Which failed in the first fixture command: EDITNow this is visible in the travis log as well. The strangest thing is: my added code did not even run yet at this point. |
|
Restarted build t see if it happens again. But the issue was before the tests started. |
|
@tomav Seems we got no luck. Could you explain the issue in more detail, maybe I can debug it locally? |
|
|
||
| NON_DEFAULT_DOCKER_MAIL_NETWORK_NAME=non-default-docker-mail-network | ||
|
|
||
| test-connected-networks: |
There was a problem hiding this comment.
I would not create a separated code for this test.
There was a problem hiding this comment.
I agree, this was a WIP state that I wanted to push to show the problem. I wanted to avoid running the whole test suite just to run this single new test. In the final version I wanted to append that to the rest.
|
Okay, I debugged and my code did run at this point. There was an error in the start-mailserver.sh, hence the maildirs were not created. Maybe we could add a test that makes it more explicit that |
|
Still the same in Travis. |
|
The code |
|
Sorry for the sluggish response, I am currently on holiday. So to answer you directly:
I was a bit unclear. My previous post was just a status report that I could confirm the issue locally. I had not pushed anything new at this point.
I just copied over what was already there for
What I gather from this: The enp... naming scheme is only applicable to a hardware interface managed by systemd in contrast to docker's virtual network devices. So I'd assume inside containers we always have ethX. Nevertheless, I still find it brittle to parse for ethX: docker might decide to change the naming after all and However, in the problem context if this PR, which comes from a docker-compose use case, we cannot know the subnets of the docker networks unless we force the user to define them statically. If we require the user to name the networks via their in container adapter names, we just shift the problem of unstable names onto the user. In the worst case, a container restart changes interface names. Do you have any preferred choice here @erik-wramner? I find the existing options to be lacking:
If I could wish I would like to have the following interface:
Unfortunately, I see no way to do step 3 within the container, unless it gets access to the docker daemon for querying. |
|
@erik-wramner This would restrict the output to one line per IPv4 virtual ethernet device and parse only subnets from the output. This is totally independent from the naming of the interfaces and could nearly grant my wish from above: I suspect the devices to be in the same order as the network definitions so using indices we can define which devices/networks to use. |
|
I don't think you can rely on the order of the networks. I haven't seen anything about a guaranteed order and if custom networks (created manually or by other components and referenced with names) are mixed with managed networks that are created with the containers the creation order may vary, which can affect the presented order. Apart from that it seems fine. Perhaps (enabled by an option) we could permit all the connected networks using this approach, i.e. no need to use names or indexes that we can't control? |
|
Hm reading docker/compose#4645 I gather that the order with
Yeah, that is the initial idea of this PR. If you are fine with that approach I will update the code to use the |
|
I'm fine with that as it is opt-in provided that we can get the tests working. You could try to rebase your branch from master, I have spent quite some time trying to get the tests stable. Perhaps that helps. I can have a look later as well. Please note that the tests only work on Linux, I've tried to run them on Mac and Windows without luck. If you still can't run locally, try on a Linux host. |
50c4e65 to
2346329
Compare
|
I rebased as you said and still got a failing test. However, I got the impression that the |
|
I'll look into it when I get time, most likely by the end of the week. I don't have access to my build environment now. |
|
@martin-schulze-vireso the tests in Travis passed, did you change something? I wonder what happens with the cleanup step where we delete the network if we haven't created the network (i.e. that or an earlier step failed). Will it succeed or do we need to use force or handle the error? Plus ideally I would like to avoid hard-coding the IP range for the custom network, but I can live with that to keep things simple. |
I did some changes but the tests were not correct until now.
The cleanup is aborted at this point. I hit this problem several times during development.
I could add some code to read out the subnet from docker directly but it makes the tests more complex. I want to give some feedback for the development process with this project:
This is the Together these shortcomings lead to a very long feedback loop when developing new tests. I'd be willing to work on some of those, should I open up separate tickets for each of them? |
|
One minor thing; the new docker container mounts the test folder. I've changed the others to mount the test/test-files folder read only instead. You should have that from the rebase. Can you do the same, please? As for the cleanup, we could either do something advanced or we can simply ignore errors. Try to run:
I fully agree with your feedback, I'm also new to this project and have also focused on the tests. In addition to your points I don't like starting all docker containers and leaving them running. Ideally there should be a test suite per container or group of containers. I think you could just use one ticket and then use multiple PRs for that. No need for extra admin! |
This will add the networks of all eth* interfaces as trusted, which is necessary if the container is in networks that are outside of the old docker default network (172.16.0.0/12), e.g. 192.168.0.0/16
See #1079 (comment) for a more detailed description of the problem that is solved here.