Fix Go SCIOND test for new topology
@@ -32,7 +32,6 @@ import (
"github.com/scionproto/scion/go/lib/common"
"github.com/scionproto/scion/go/lib/infra/modules/trust/trustdb"
"github.com/scionproto/scion/go/lib/log"
- "github.com/scionproto/scion/go/lib/overlay"
"github.com/scionproto/scion/go/lib/sciond"
"github.com/scionproto/scion/go/lib/scrypto/trc"
"github.com/scionproto/scion/go/lib/topology"
@@ -161,19 +160,26 @@ func TestIFInfo(t *testing.T) {
RawEntries: []sciond.IFInfoReplyEntry{
{
IfID: ifids[0],
- HostInfo: MakeBRHostInfos(topo.Overlay, topo.BR, topo.IFInfoMap)[0],
+ HostInfo: servers.TopoAddrToHostInfo(topo.Overlay,
+ *topo.IFInfoMap[ifids[0]].InternalAddrs),
},
},
},
},
{
- Name: "no ifid",
+ Name: "two ifids",
IFIDs: []common.IFIDType{},
Expected: &sciond.IFInfoReply{
RawEntries: []sciond.IFInfoReplyEntry{
{
IfID: ifids[0],
- HostInfo: MakeBRHostInfos(topo.Overlay, topo.BR, topo.IFInfoMap)[0],
+ HostInfo: servers.TopoAddrToHostInfo(topo.Overlay,
+ *topo.IFInfoMap[ifids[0]].InternalAddrs),
+ },
+ {
+ IfID: ifids[1],
+ HostInfo: servers.TopoAddrToHostInfo(topo.Overlay,
+ *topo.IFInfoMap[ifids[1]].InternalAddrs),
},
},
},
@@ -188,7 +194,10 @@ func TestIFInfo(t *testing.T) {
Convey(tc.Name, t, func() {
reply, err := conn.IFInfo(tc.IFIDs)
SoMsg("err", err, ShouldBeNil)
- SoMsg("reply", reply, ShouldResemble, tc.Expected)
+ SoMsg("len", len(reply.RawEntries), ShouldEqual, len(tc.Expected.RawEntries))
+ for i, v := range tc.Expected.RawEntries {
+ SoMsg(fmt.Sprintf("%d", i), v, ShouldBeIn, reply.RawEntries)
+ }
})
}
}
@@ -341,17 +350,3 @@ func TestMain(m *testing.M) {
}
os.Exit(m.Run())
}
-
-func MakeBRHostInfos(ot overlay.Type, brMap map[string]topology.BRInfo,
- ifInfoMap map[common.IFIDType]topology.IFInfo) []sciond.HostInfo {
-
- hostInfos := make([]sciond.HostInfo, 0, len(brMap))
- for _, brInfo := range brMap {
- // One IFID is enough to find the unique internal address. Panic if no
- // IFIDs exist.
- ifid := brInfo.IFIDs[0]
- hostInfos = append(hostInfos,
- servers.TopoAddrToHostInfo(ot, *ifInfoMap[ifid].InternalAddrs))
- }
- return hostInfos
-}
