Skip to content

Commit eecd9af

Browse files
committed
add batch tests
1 parent 7f1c198 commit eecd9af

File tree

2 files changed

+182
-17
lines changed

2 files changed

+182
-17
lines changed

tests/CTS/requests/composition/multipleBatch.json

Lines changed: 78 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@
6262
}
6363
},
6464
{
65-
"skipLanguages": [
66-
"kotlin"
67-
],
65+
"skipLanguages": ["kotlin"],
6866
"parameters": {
6967
"requests": [
7068
{
@@ -147,9 +145,7 @@
147145
}
148146
},
149147
{
150-
"skipLanguages": [
151-
"kotlin"
152-
],
148+
"skipLanguages": ["kotlin"],
153149
"parameters": {
154150
"requests": [
155151
{
@@ -312,5 +308,81 @@
312308
]
313309
}
314310
}
311+
},
312+
{
313+
"skipLanguages": ["kotlin"],
314+
"parameters": {
315+
"requests": [
316+
{
317+
"action": "upsert",
318+
"body": {
319+
"objectID": "my-compo",
320+
"name": "my composition",
321+
"behavior": {
322+
"injection": {
323+
"main": {
324+
"source": {
325+
"search": {
326+
"index": "foo"
327+
}
328+
}
329+
},
330+
"injectedItems": [
331+
{
332+
"key": "injectedItem1",
333+
"source": {
334+
"search": {
335+
"index": "foo"
336+
}
337+
},
338+
"position": 2,
339+
"length": 1
340+
}
341+
],
342+
"deduplication": {
343+
"positioning": "highest"
344+
}
345+
}
346+
}
347+
}
348+
}
349+
]
350+
},
351+
"request": {
352+
"path": "/1/compositions/*/batch",
353+
"method": "POST",
354+
"body": {
355+
"requests": {
356+
"objectID": "my-compo",
357+
"name": "my composition",
358+
"behavior": {
359+
"injection": {
360+
"main": {
361+
"source": {
362+
"search": {
363+
"index": "foo"
364+
}
365+
}
366+
},
367+
"injectedItems": [
368+
{
369+
"key": "injectedItem1",
370+
"source": {
371+
"search": {
372+
"index": "foo"
373+
}
374+
},
375+
"position": 2,
376+
"length": 1
377+
}
378+
],
379+
"deduplication": {
380+
"positioning": "highest"
381+
}
382+
}
383+
}
384+
}
385+
}
386+
}
315387
}
316388
]

tests/CTS/requests/composition/saveRules.json

Lines changed: 104 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@
6565
}
6666
},
6767
{
68-
"skipLanguages": [
69-
"kotlin"
70-
],
68+
"skipLanguages": ["kotlin"],
7169
"parameters": {
7270
"compositionID": "rule-with-metadata",
7371
"rules": {
@@ -200,10 +198,7 @@
200198
"body": {
201199
"objectID": "rule-with-exernal-source",
202200
"description": "my description",
203-
"tags": [
204-
"tag1",
205-
"tag2"
206-
],
201+
"tags": ["tag1", "tag2"],
207202
"enabled": true,
208203
"validity": [
209204
{
@@ -268,10 +263,7 @@
268263
"body": {
269264
"objectID": "rule-with-exernal-source",
270265
"description": "my description",
271-
"tags": [
272-
"tag1",
273-
"tag2"
274-
],
266+
"tags": ["tag1", "tag2"],
275267
"enabled": true,
276268
"validity": [
277269
{
@@ -326,5 +318,106 @@
326318
]
327319
}
328320
}
321+
},
322+
{
323+
"parameters": {
324+
"compositionID": "my-compo",
325+
"rules": {
326+
"requests": [
327+
{
328+
"action": "upsert",
329+
"body": {
330+
"objectID": "rule-with-deduplication",
331+
"description": "my description",
332+
"enabled": true,
333+
"conditions": [
334+
{
335+
"anchoring": "contains",
336+
"pattern": "harry"
337+
}
338+
],
339+
"consequence": {
340+
"behavior": {
341+
"injection": {
342+
"main": {
343+
"source": {
344+
"search": {
345+
"index": "my-index"
346+
}
347+
}
348+
},
349+
"injectedItems": [
350+
{
351+
"key": "injectedItem",
352+
"source": {
353+
"search": {
354+
"index": "my-index"
355+
}
356+
},
357+
"position": 0,
358+
"length": 3
359+
}
360+
],
361+
"deduplication": {
362+
"positioning": "highestInjected"
363+
}
364+
}
365+
}
366+
}
367+
}
368+
}
369+
]
370+
}
371+
},
372+
"request": {
373+
"path": "/1/compositions/my-compo/rules/batch",
374+
"method": "POST",
375+
"body": {
376+
"requests": [
377+
{
378+
"action": "upsert",
379+
"body": {
380+
"objectID": "rule-with-deduplication",
381+
"description": "my description",
382+
"enabled": true,
383+
"conditions": [
384+
{
385+
"anchoring": "contains",
386+
"pattern": "harry"
387+
}
388+
],
389+
"consequence": {
390+
"behavior": {
391+
"injection": {
392+
"main": {
393+
"source": {
394+
"search": {
395+
"index": "my-index"
396+
}
397+
}
398+
},
399+
"injectedItems": [
400+
{
401+
"key": "injectedItem",
402+
"source": {
403+
"search": {
404+
"index": "my-index"
405+
}
406+
},
407+
"position": 0,
408+
"length": 3
409+
}
410+
],
411+
"deduplication": {
412+
"positioning": "highestInjected"
413+
}
414+
}
415+
}
416+
}
417+
}
418+
}
419+
]
420+
}
421+
}
329422
}
330423
]

0 commit comments

Comments
 (0)