Make code coverage work through the proxy

Previously, the proxy would run the weave script in ways that did
not run the weaver executable.  Now they can.  This is a problem because
of the contortions involved in using golang's code coverage support
in the integration tests, which require the weaver command line args to
be slightly mangled.
This commit is contained in:
David Wragg committed 2015-10-12 21:27:11 +01:00
1 parent 431197042d
commit b56ff7678c
3 files changed
+25 -8

No files matched your search

+7 -5
View File
@@ -436,13 +436,15 @@ func (proxy *Proxy) getDNSDomain() (domain string) {
}
weaveContainer, err := proxy.client.InspectContainer("weave")
if err != nil ||
weaveContainer.NetworkSettings == nil ||
weaveContainer.NetworkSettings.IPAddress == "" {
return
var weaveIP string
if err == nil && weaveContainer.NetworkSettings != nil {
weaveIP = weaveContainer.NetworkSettings.IPAddress
}
if weaveIP == "" {
weaveIP = "127.0.0.1"
}
url := fmt.Sprintf("http://%s:%d/domain", weaveContainer.NetworkSettings.IPAddress, router.HTTPPort)
url := fmt.Sprintf("http://%s:%d/domain", weaveIP, router.HTTPPort)
resp, err := http.Get(url)
if err != nil || resp.StatusCode != http.StatusOK {
return