-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Improve Marathon integration tests. #1406
Conversation
According to @vdemeester, it's because the version of libcompose we use does not support docker-compose v2 yet. |
1b788dc
to
4dabfe1
Compare
This PR is blocked because we first need to update libcompose (through libkermit) in order to have docker-compose version 2 which brings custom networking support. Otherwise, we cannot talk to the Marathon instances from the integration tests. Updating libcompose is non-trivial, once again due to glide and our two-glide-manifests setup. |
Note to myself: Also update go-marathon integration dependency. |
f5194c7
to
4f0ab7c
Compare
Turns out networking aliasing isn't properly working in libcompose, which is a blocker for the required inter-container communication on the Marathon docker-compose manifest. Our very own @vdemeester is on it. :-) |
4f0ab7c
to
9f0c14f
Compare
Currently being show-stopped by docker/libcompose#484. Sending all bug reports directly to @vdemeester. :) |
How you have retry since docker/libcompose#483? |
@ldez I did retry, and that helped us move forward a bit. However, I then ran into docker/libcompose#484. That's still the latest blocker. |
Trying if switching to host network helps. Can only debug this properly on the CI. |
39fa372
to
ffb862a
Compare
3ba68dd
to
924f071
Compare
integration/marathon_test.go
Outdated
// Wait for Marathon readiness prior to creating the client so that we | ||
// don't run into the "all cluster members down" state right from the | ||
// start. | ||
err := try.GetRequest(marathonURL+"/ping", 1*time.Minute, try.StatusCodeIs(http.StatusOK)) |
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.
Could you move this into the setup like the others provider integration tests?
And maybe call /leader
instead of /ping
?
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.
Good idea (on both). Done.
integration/marathon_test.go
Outdated
//}) | ||
// | ||
//c.Assert(err, checker.IsNil) | ||
func (s *MarathonSuite) getContainerIPAddr(c *check.C, name string) string { |
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.
seems unnecessary: just put the 2 lines in the setup.
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 can move it if you like; just to be sure though: did you notice that I need it once for the Mesos slave and another time for Marathon? That'd be 4 lines, so I wanted to avoid code duplication. (In fact, the function would be reusable if we turned s.composeProject
into a function parameter, which would allow us to apply it in a lot of other tests as well.)
Personally, I also find getContainerIPAddr(c, name)
more readable and comprehendible compared to s.composeProject.Container(c, name).NetworkSettings.IPAddress
.
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 understand you can create a function getContainerIPAddr
in integration_test.go
func (s *BaseSuite) getContainerIPAddr(c *check.C, name string) string {
ipAddr := s.composeProject.Container(c, name).NetworkSettings.IPAddress
c.Assert(ipAddr, checker.Not(checker.HasLen), 0)
return ipAddr
}
But I think this refactor must be done in another PR.
integration/marathon_test.go
Outdated
deploy, err := client.UpdateApplication(app, false) | ||
c.Assert(err, checker.IsNil) | ||
// Wait for deployment to complete. | ||
c.Assert(client.WaitOnDeployment(deploy.DeploymentID, 2*time.Minute), checker.IsNil) |
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.
2 minutes ?
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.
Cut in half. (Although a higher timeout doesn't really hurt us in the regular case where things go fast and possibly saves us if there's higher latency for whatever reason.)
integration/marathon_test.go
Outdated
|
||
// Query application via Traefik. | ||
err = try.GetRequest("http://127.0.0.1:8000/service", 1*time.Minute, try.StatusCodeIs(http.StatusOK)) |
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.
1 minutes ?
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.
Cut down to 30 seconds.
integration/marathon_test.go
Outdated
client, err := marathon.NewClient(config) | ||
c.Assert(err, checker.IsNil) | ||
|
||
showTraefikLog := true |
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.
maybe you can add a small comment to explains that in the code.
I also just realized that the Simplifying the configuration even further doesn't really give us any automatic guarantee. As there's no way to reliably tell if we got a 404 because we haven't added a Marathon application yet, I removed the test. It doesn't add any value to me. WDYT? |
@timoreimann I agree |
863dfe7
to
3d96921
Compare
3d96921
to
54ca70e
Compare
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.
LGTM
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.
LGTM
integration/marathon_test.go
Outdated
// enjoy DNS-discoverable container host names. | ||
mesosSlaveIPAddr := s.composeProject.Container(c, containerNameMesosSlave).NetworkSettings.IPAddress | ||
c.Assert(mesosSlaveIPAddr, checker.Not(checker.HasLen), 0) | ||
c.Assert(s.extendDockerHostsFile(containerNameMesosSlave, mesosSlaveIPAddr), checker.IsNil) |
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 prefer when we split the call and the assert (more readable for me, but I can live with it)
err := s.extendDockerHostsFile(containerNameMesosSlave, mesosSlaveIPAddr)
c.Assert(err, checker.IsNil)
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.
Separating the call and the check would actually be more consistent with our existing style.
Updated.
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.
Thanks a lot @timoreimann !
LGTM
5c194f6
to
c5dcd56
Compare
Update github.com/docker/libcompose in glide.* files. Vendor github.com/docker/libcompose update.
- Update compose file. - Add integration test for Marathon application deployment.
c5dcd56
to
95a49ff
Compare
This is a continuation of #1398.
The tests do not succeed yet, apparently because the external network isn't applied.