func registerAddr(reg *registry.RouteRegistry, path string, routeServiceUrl string, addr net.Addr, instanceId, instanceIndex, appId string) { host, portStr, err := net.SplitHostPort(addr.String()) Expect(err).NotTo(HaveOccurred()) port, err := strconv.Atoi(portStr) Expect(err).NotTo(HaveOccurred()) reg.Register(route.Uri(path), route.NewEndpoint(appId, host, uint16(port), instanceId, instanceIndex, nil, -1, routeServiceUrl, models.ModificationTag{})) }
b, e := json.Marshal(v) Expect(e).ToNot(HaveOccurred()) d := make(map[string]interface{}) e = json.Unmarshal(b, &d) Expect(e).ToNot(HaveOccurred()) for _, k := range members { _, ok := d[k] Expect(ok).To(BeTrue(), k) } }) It("reports seconds since last registry update", func() { Registry.Register("foo", &route.Endpoint{}) time.Sleep(10 * time.Millisecond) timeSince := findValue(Varz, "ms_since_last_registry_update").(float64) Expect(timeSince).To(BeNumerically("<", 1000)) Expect(timeSince).To(BeNumerically(">=", 10)) }) It("has urls", func() { Expect(findValue(Varz, "urls")).To(Equal(float64(0))) var fooReg = route.NewEndpoint("12345", "192.168.1.1", 1234, "", "", map[string]string{}, -1, "", models.ModificationTag{}) // Add a route Registry.Register("foo.vcap.me", fooReg)