MCPcopy Create free account
hub / github.com/SeldonIO/seldon-core / testUpdateModelVersion

Function testUpdateModelVersion

scheduler/pkg/envoy/processor/server_test.go:117–146  ·  view source on GitHub ↗
(g *WithT, inc *IncrementalProcessor, c client.ADSClient)

Source from the content-addressed store, hash-verified

115}
116
117func 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
148func fetch(c client.ADSClient, g *WithT, expectedClusterNames []string) []string {
149 actualClusterNames := make([]string, 0)

Callers 1

TestFetchFunction · 0.85

Calls 3

createTestModelFunction · 0.85
fetchFunction · 0.85
LoadMethod · 0.65

Tested by

no test coverage detected