mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-05 11:11:13 +00:00
- 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
72 lines
1.4 KiB
Go
72 lines
1.4 KiB
Go
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
|
|
}
|