@@ -37,30 +37,29 @@ import (
3737
3838func TestLoadBalancingCursorVST (t * testing.T ) {
3939 // run with VST
40- LoadBalancingCursorSubtest (t , true )
40+ loadBalancingCursorSubtest (t , true )
4141}
4242
4343func TestLoadBalancingCursorHTTP (t * testing.T ) {
4444 // run with HTTP
45- LoadBalancingCursorSubtest (t , false )
45+ loadBalancingCursorSubtest (t , false )
4646}
4747
48- func wasForwarded (r * driver.Response ) bool {
49- h := ( * r ) .Header ("x-arango-request-served-by " )
48+ func wasForwarded (r driver.Response ) bool {
49+ h := r .Header ("x-arango-request-forwarded-to " )
5050 return h != ""
5151}
5252
5353// tests cursor forwarding with load-balanced conn.
54- func LoadBalancingCursorSubtest (t * testing.T , useVst bool ) {
54+ func loadBalancingCursorSubtest (t * testing.T , useVst bool ) {
5555 c := client .MustNewInCluster ()
5656 kubecli := mustNewKubeClient (t )
5757 ns := getNamespace (t )
5858
5959 // Prepare deployment config
6060 depl := newDeployment ("test-lb-" + uniuri .NewLen (4 ))
6161 depl .Spec .Mode = api .NewMode (api .DeploymentModeCluster )
62- image := "dhly/arangodb:3.3.11-local"
63- depl .Spec .Image = & image
62+ depl .Spec .Image = util .NewString ("arangodb/arangodb:3.3.13" )
6463
6564 // Create deployment
6665 _ , err := c .DatabaseV1alpha ().ArangoDeployments (ns ).Create (depl )
@@ -135,72 +134,12 @@ func LoadBalancingCursorSubtest(t *testing.T, useVst bool) {
135134 ExpectedDocuments : collectionData ["books" ],
136135 DocumentType : reflect .TypeOf (Book {}),
137136 },
138- /* queryTest{
139- Query: "FOR d IN books FILTER d.Title==@title SORT d.Title RETURN d",
140- BindVars: map[string]interface{}{"title": "Book 02"},
141- ExpectSuccess: true,
142- ExpectedDocuments: []interface{}{collectionData["books"][1]},
143- DocumentType: reflect.TypeOf(Book{}),
144- },
145- queryTest{
146- Query: "FOR d IN books FILTER d.Title==@title SORT d.Title RETURN d",
147- BindVars: map[string]interface{}{"somethingelse": "Book 02"},
148- ExpectSuccess: false, // Unknown `@title`
149- },
150- queryTest{
151- Query: "FOR u IN users FILTER u.age>100 SORT u.name RETURN u",
152- ExpectSuccess: true,
153- ExpectedDocuments: []interface{}{},
154- DocumentType: reflect.TypeOf(UserDoc{}),
155- },
156- queryTest{
157- Query: "FOR u IN users FILTER u.age<@maxAge SORT u.name RETURN u",
158- BindVars: map[string]interface{}{"maxAge": 20},
159- ExpectSuccess: true,
160- ExpectedDocuments: []interface{}{collectionData["users"][2], collectionData["users"][0], collectionData["users"][5]},
161- DocumentType: reflect.TypeOf(UserDoc{}),
162- },
163- queryTest{
164- Query: "FOR u IN users FILTER u.age<@maxAge SORT u.name RETURN u",
165- BindVars: map[string]interface{}{"maxage": 20},
166- ExpectSuccess: false, // `@maxage` versus `@maxAge`
167- },
168- queryTest{
169- Query: "FOR u IN users SORT u.age RETURN u.age",
170- ExpectedDocuments: []interface{}{12, 12, 13, 25, 42, 67},
171- DocumentType: reflect.TypeOf(12),
172- ExpectSuccess: true,
173- },
174- queryTest{
175- Query: "FOR p IN users COLLECT a = p.age WITH COUNT INTO c SORT a RETURN [a, c]",
176- ExpectedDocuments: []interface{}{[]int{12, 2}, []int{13, 1}, []int{25, 1}, []int{42, 1}, []int{67, 1}},
177- DocumentType: reflect.TypeOf([]int{}),
178- ExpectSuccess: true,
179- },
180- queryTest{
181- Query: "FOR u IN users SORT u.name RETURN u.name",
182- ExpectedDocuments: []interface{}{"Blair", "Clair", "Jake", "John", "Johnny", "Zz"},
183- DocumentType: reflect.TypeOf("foo"),
184- ExpectSuccess: true,
185- },*/
186137 }
187138
188139 var r driver.Response
189140 // Setup context alternatives
190141 contexts := []queryTestContext {
191- /*queryTestContext{driver.WithResponse(nil, &r), false},
192- queryTestContext{driver.WithResponse(context.Background(), &r), false},
193- queryTestContext{driver.WithResponse(driver.WithQueryCount(nil), &r), true},
194- queryTestContext{driver.WithResponse(driver.WithQueryCount(nil, true), &r), true},
195- queryTestContext{driver.WithResponse(driver.WithQueryCount(nil, false), &r), false},*/
196142 queryTestContext {driver .WithResponse (driver .WithQueryBatchSize (nil , 1 ), & r ), false },
197- /*queryTestContext{driver.WithResponse(driver.WithQueryCache(nil), &r), false},
198- queryTestContext{driver.WithResponse(driver.WithQueryCache(nil, true), &r), false},
199- queryTestContext{driver.WithResponse(driver.WithQueryCache(nil, false), &r), false},
200- queryTestContext{driver.WithResponse(driver.WithQueryMemoryLimit(nil, 60000), &r), false},
201- queryTestContext{driver.WithResponse(driver.WithQueryTTL(nil, time.Minute), &r), false},
202- queryTestContext{driver.WithResponse(driver.WithQueryBatchSize(driver.WithQueryCount(nil), 1), &r), true},
203- queryTestContext{driver.WithResponse(driver.WithQueryCache(driver.WithQueryCount(driver.WithQueryBatchSize(nil, 2))), &r), true},*/
204143 }
205144
206145 // keep track of whether at least one request was forwarded internally to the
@@ -247,7 +186,7 @@ func LoadBalancingCursorSubtest(t *testing.T, useVst bool) {
247186 t .Error ("HasMore returned false, but ReadDocument returns a document" )
248187 }
249188 result = append (result , doc .Elem ().Interface ())
250- if wasForwarded (& r ) {
189+ if ( wasForwarded (r ) ) {
251190 someRequestForwarded = true
252191 }
253192 time .Sleep (200 * time .Millisecond )
0 commit comments