(g *WithT, inc *IncrementalProcessor, c client.ADSClient)
| 115 | } |
| 116 | |
| 117 | func testUpdateModelVersion(g *WithT, inc *IncrementalProcessor, c client.ADSClient) func(t *testing.T) { |
| 118 | secondFetch := []string{"model_2_grpc", "model_2_http"} |
| 119 | |
| 120 | return func(t *testing.T) { |
| 121 | ops := []func(inc *IncrementalProcessor, g *WithT){ |
| 122 | createTestModel("model", "server", 1, []int{0}, 2, []store.ModelReplicaState{store.Available}), |
| 123 | } |
| 124 | go func() { |
| 125 | for _, op := range ops { |
| 126 | op(inc, g) |
| 127 | } |
| 128 | }() |
| 129 | |
| 130 | g.Eventually(func() bool { |
| 131 | for _, key := range []string{"model_2_grpc", "model_2_http"} { |
| 132 | _, ok := inc.xdsCache.Clusters.Load(key) |
| 133 | if ok { |
| 134 | return true |
| 135 | } |
| 136 | } |
| 137 | return false |
| 138 | }).WithPolling(100 * time.Millisecond).WithTimeout(5 * time.Second).Should(BeTrue()) |
| 139 | |
| 140 | result := fetch(c, g, secondFetch) |
| 141 | |
| 142 | // version 2 exists |
| 143 | g.Expect(result).Should(ContainElements(permanentClusterNames)) |
| 144 | g.Expect(result).Should(ContainElements(secondFetch)) |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | func fetch(c client.ADSClient, g *WithT, expectedClusterNames []string) []string { |
| 149 | actualClusterNames := make([]string, 0) |
no test coverage detected