func waitMsgReceived(registry *registry.RouteRegistry, app *test.TestApp, expectedToBeFound bool, timeout time.Duration) bool { interval := time.Millisecond * 50 repetitions := int(timeout / interval) for j := 0; j < repetitions; j++ { if j > 0 { time.Sleep(interval) } received := true for _, url := range app.Urls() { pool := registry.Lookup(url) if expectedToBeFound && pool == nil { received = false break } else if !expectedToBeFound && pool != nil { received = false break } } if received { return true } } return false }
func appUnregistered(registry *registry.RouteRegistry, app *common.TestApp) bool { for _, url := range app.Urls() { pool := registry.Lookup(url) if pool != nil { return false } } return true }
{ "dea": "dea1", "app": "app1", "uris": [ "test.com" ], "host": "1.2.3.4", "port": 65536, "private_instance_id": "private_instance_id" } `)) }) It("does not add the route to the route table", func() { // Pool.IsEmpty() is better but the pool is not intialized yet Consistently(func() *route.Pool { return registry.Lookup("test.com") }).Should(BeZero()) }) }) }) }) func readVarz(v vvarz.Varz) map[string]interface{} { varz_byte, err := v.MarshalJSON() Expect(err).ToNot(HaveOccurred()) varz_data := make(map[string]interface{}) err = json.Unmarshal(varz_byte, &varz_data) Expect(err).ToNot(HaveOccurred()) return varz_data }