MCPcopy Create free account
hub / github.com/encodeous/nylon / TestRouterBasicComputeRoutes

Function TestRouterBasicComputeRoutes

core/router_test.go:30–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestRouterBasicComputeRoutes(t *testing.T) {
31 tunables := ConfigureConstants()
32 h := &RouterHarness{}
33 aPrefix := nodeToPrefix("a")
34 rs := state.RouterState{
35 RouterTunables: tunables,
36 Id: "a",
37 SelfSeqno: make(map[netip.Prefix]uint16),
38 Routes: make(map[netip.Prefix]state.SelRoute),
39 Sources: make(map[state.Source]state.FD),
40 Neighbours: MakeNeighbours("b", "c", "d"),
41 Advertised: map[netip.Prefix]state.Advertisement{aPrefix: {NodeId: state.NodeId("a"), Expiry: maxTime}},
42 }
43 ComputeRoutes(&rs, h)
44 // we should have only routes to ourselves
45 if len(rs.Routes) != 1 {
46 t.Errorf("Expected 1 route, got %d", len(rs.Routes))
47 }
48 if _, ok := rs.Routes[aPrefix]; !ok {
49 t.Errorf("Expected route to service 'a', but it was not found")
50 }
51 out := h.GetActions()
52 out.AssertContains(t, BroadcastUpdateRoute(MakePubRoute("a", aPrefix, 0, 0)))
53}
54
55func TestRouterNet1A_BasicRetraction(t *testing.T) {
56 tunables := ConfigureConstants()

Callers

nothing calls this directly

Calls 9

GetActionsMethod · 0.95
NodeIdTypeAlias · 0.92
ConfigureConstantsFunction · 0.85
nodeToPrefixFunction · 0.85
MakeNeighboursFunction · 0.85
ComputeRoutesFunction · 0.85
BroadcastUpdateRouteFunction · 0.85
MakePubRouteFunction · 0.85
AssertContainsMethod · 0.80

Tested by

no test coverage detected