}) }) It("adds a route", func() { err := routeManager.AddRoute("my-link", network, gateway) Expect(err).NotTo(HaveOccurred()) Expect(netlinker.RouteAddCallCount()).To(Equal(1)) route := netlinker.RouteAddArgsForCall(0) Expect(route).To(Equal(&netlink.Route{ LinkIndex: 999, Scope: netlink.SCOPE_UNIVERSE, Dst: network, Gw: gateway, })) }) Context("when adding the route fails", func() { BeforeEach(func() { netlinker.RouteAddReturns(errors.New("welp")) }) It("returns the error", func() { err := routeManager.AddRoute("my-link", network, gateway) Expect(err).To(MatchError("route add failed: welp")) }) }) }) })