|
|
@ -23,9 +23,12 @@ func fieldsOf(t reflect.Type) (fields []string) {
|
|
|
|
|
|
|
|
|
|
|
|
func TestHostinfoEqual(t *testing.T) {
|
|
|
|
func TestHostinfoEqual(t *testing.T) {
|
|
|
|
hiHandles := []string{
|
|
|
|
hiHandles := []string{
|
|
|
|
"IPNVersion", "FrontendLogID", "BackendLogID", "OS", "OSVersion",
|
|
|
|
"IPNVersion", "FrontendLogID", "BackendLogID",
|
|
|
|
"DeviceModel", "Hostname", "ShieldsUp", "GoArch", "RoutableIPs",
|
|
|
|
"OS", "OSVersion", "DeviceModel", "Hostname",
|
|
|
|
"RequestTags", "Services", "NetInfo",
|
|
|
|
"ShieldsUp", "ShareeNode",
|
|
|
|
|
|
|
|
"GoArch",
|
|
|
|
|
|
|
|
"RoutableIPs", "RequestTags",
|
|
|
|
|
|
|
|
"Services", "NetInfo",
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if have := fieldsOf(reflect.TypeOf(Hostinfo{})); !reflect.DeepEqual(have, hiHandles) {
|
|
|
|
if have := fieldsOf(reflect.TypeOf(Hostinfo{})); !reflect.DeepEqual(have, hiHandles) {
|
|
|
|
t.Errorf("Hostinfo.Equal check might be out of sync\nfields: %q\nhandled: %q\n",
|
|
|
|
t.Errorf("Hostinfo.Equal check might be out of sync\nfields: %q\nhandled: %q\n",
|
|
|
@ -169,6 +172,11 @@ func TestHostinfoEqual(t *testing.T) {
|
|
|
|
&Hostinfo{Services: []Service{Service{Proto: TCP, Port: 1234, Description: "foo"}}},
|
|
|
|
&Hostinfo{Services: []Service{Service{Proto: TCP, Port: 1234, Description: "foo"}}},
|
|
|
|
true,
|
|
|
|
true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
&Hostinfo{ShareeNode: true},
|
|
|
|
|
|
|
|
&Hostinfo{},
|
|
|
|
|
|
|
|
false,
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for i, tt := range tests {
|
|
|
|
for i, tt := range tests {
|
|
|
|
got := tt.a.Equal(tt.b)
|
|
|
|
got := tt.a.Equal(tt.b)
|
|
|
|