mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-28 17:51:21 +00:00
Use Node.Sets for Host Local Networks.
This commit is contained in:
@@ -2,7 +2,6 @@ package host
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/weaveworks/scope/report"
|
||||
@@ -71,11 +70,12 @@ func (r *Reporter) Report() (report.Report, error) {
|
||||
rep.Host.AddNode(report.MakeHostNodeID(r.hostID), report.MakeNodeWith(map[string]string{
|
||||
Timestamp: Now(),
|
||||
HostName: r.hostName,
|
||||
LocalNetworks: strings.Join(localCIDRs, " "),
|
||||
OS: runtime.GOOS,
|
||||
Load: GetLoad(),
|
||||
KernelVersion: kernel,
|
||||
Uptime: uptime.String(),
|
||||
}).WithSets(report.Sets{
|
||||
LocalNetworks: report.MakeStringSet(localCIDRs...),
|
||||
}))
|
||||
|
||||
return rep, nil
|
||||
|
||||
@@ -48,11 +48,12 @@ func TestReporter(t *testing.T) {
|
||||
want.Host.AddNode(report.MakeHostNodeID(hostID), report.MakeNodeWith(map[string]string{
|
||||
host.Timestamp: now,
|
||||
host.HostName: hostname,
|
||||
host.LocalNetworks: network,
|
||||
host.OS: runtime.GOOS,
|
||||
host.Load: load,
|
||||
host.Uptime: uptime,
|
||||
host.KernelVersion: kernel,
|
||||
}).WithSets(report.Sets{
|
||||
host.LocalNetworks: report.MakeStringSet(network),
|
||||
}))
|
||||
have, _ := host.NewReporter(hostID, hostname, localNets).Report()
|
||||
if !reflect.DeepEqual(want, have) {
|
||||
|
||||
Reference in New Issue
Block a user