Decouple Scope lifecycle from Weave lifecycle

- Run the Weave integrations regardless of if weave is detected.
- Make everything backoff and not spam the logs.
- Add miekg dns to vendor.
- Have the app periodically register with weaveDNS, and the probe do lookups there.
- Decide what the local networks are at runtime, not once at startup.
- Correctly resolve app ids, fixes #825
This commit is contained in:
Tom Wilkie
2016-01-27 20:09:24 -08:00
committed by Paul Bellamy
parent 26ccb4918b
commit d4e58b9e33
85 changed files with 22644 additions and 336 deletions

View File

@@ -60,6 +60,14 @@ func (c *mockCmd) Kill() error {
return nil
}
func (c *mockCmd) Output() ([]byte, error) {
return ioutil.ReadAll(c.ReadCloser)
}
func (c *mockCmd) Run() error {
return nil
}
func (b *blockingReader) Read(p []byte) (n int, err error) {
<-b.quit
return 0, nil

71
test/weave/mock.go Normal file
View File

@@ -0,0 +1,71 @@
package weave
import (
"net"
"github.com/weaveworks/scope/common/weave"
)
// Constants used for testing
const (
MockWeavePeerName = "winnebago"
MockWeavePeerNickName = "winny"
MockContainerID = "83183a667c01"
MockContainerMAC = "d6:f2:5a:12:36:a8"
MockContainerIP = "10.0.0.123"
MockHostname = "hostname.weave.local"
)
// MockClient is a mock version of weave.Client
type MockClient struct{}
// Status implements weave.Client
func (MockClient) Status() (weave.Status, error) {
return weave.Status{
Router: weave.Router{
Peers: []struct {
Name string
NickName string
}{
{
Name: MockWeavePeerName,
NickName: MockWeavePeerNickName,
},
},
},
DNS: weave.DNS{
Entries: []struct {
Hostname string
ContainerID string
Tombstone int64
}{
{
Hostname: MockHostname + ".",
ContainerID: MockContainerID,
Tombstone: 0,
},
},
},
}, nil
}
// AddDNSEntry implements weave.Client
func (MockClient) AddDNSEntry(fqdn, containerid string, ip net.IP) error {
return nil
}
// PS implements weave.Client
func (MockClient) PS() (map[string]weave.PSEntry, error) {
return map[string]weave.PSEntry{
MockContainerID: {
ContainerIDPrefix: MockContainerID,
MACAddress: MockContainerMAC,
IPs: []string{MockContainerIP},
},
}, nil
}
// Expose implements weave.Client
func (MockClient) Expose() error {
return nil
}