Skip to content

Commit 88de8b8

Browse files
authored
Added retry. (#453)
* Added retry. Signed-off-by: dblock <[email protected]>
1 parent 7cae0b8 commit 88de8b8

File tree

15 files changed

+325
-153
lines changed

15 files changed

+325
-153
lines changed

.cspell

Lines changed: 52 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,8 @@
1-
APIV
2-
Boxplot
3-
Bobg
4-
Boundsdouble
5-
CBOR
6-
DNFOF
7-
Decompounder
8-
Downsample
9-
Downsampling
10-
Ewma
11-
Fielddata
12-
Formattable
13-
Fragmenter
14-
Geohex
15-
Gsub
16-
Intertransport
17-
Jelinek
18-
Kuromoji
19-
Lovins
20-
Lucene
21-
Millis
22-
Moneyball
23-
Multisearch
24-
Moneyball
25-
Nanos
26-
Nori
27-
ONNX
28-
OPENSEARCH
29-
OSCPU
30-
Oversample
31-
Rebalance
32-
Reindex
33-
Rethrottle
34-
Rolespan
35-
Rollup
36-
Rollups
37-
Slowlog
38-
Sorani
39-
Stringifiedboolean
40-
Stringifiedinteger
41-
Tfidf
42-
Tika
43-
Translog
44-
Unmanaged
45-
Yrtsd
461
aarch
472
actiongroup
483
actiongroups
494
aggregatable
5+
APIV
506
argjson
517
asciifolding
528
authc
@@ -56,63 +12,92 @@ autocut
5612
backendroles
5713
backpressure
5814
beider
15+
Bobg
16+
Boundsdouble
5917
boxplot
18+
Boxplot
6019
caverphone
20+
CBOR
6121
charfilters
6222
chisquared
6323
chuhlomin
6424
cpuacct
25+
cuserr
6526
daitch
6627
dangoslen
6728
dashboardsinfo
29+
datarows
6830
decompounder
31+
Decompounder
6932
dedup
7033
determinized
34+
distilbert
35+
DNFOF
7136
docvalue
37+
Downsample
7238
downsampling
39+
Downsampling
7340
evals
7441
ewma
42+
Ewma
7543
faiss
7644
fielddata
45+
Fielddata
7746
forcemerge
47+
Formattable
7848
fragmenter
49+
Fragmenter
7950
freqs
8051
generateonbehalfoftoken
8152
geohash
8253
geohex
54+
Geohex
8355
geoip
8456
geotile
8557
gsub
58+
Gsub
8659
haasephonetik
8760
heteroscedastic
8861
homoscedastic
8962
hotthreads
63+
huggingface
9064
hybridfs
9165
integ
9266
internalusers
67+
Intertransport
68+
Jelinek
9369
kibanainfo
9470
kibanaserver
9571
koelnerphonetik
9672
kstem
9773
kuromoji
74+
Kuromoji
9875
languageset
76+
Lovins
9977
lucene
78+
Lucene
10079
lycheeverse
10180
marvinpinto
10281
metaphone
10382
mget
10483
millis
84+
Millis
10585
mlockall
10686
mmap
10787
mmapfs
10888
mmdb
10989
mokotoff
90+
Moneyball
91+
Moneyball
11092
msearch
93+
msmarco
11194
mtermvectors
11295
mult
96+
Multisearch
11397
multitenancy
11498
mxyz
11599
nanos
100+
Nanos
116101
nbest
117102
nfkc
118103
ngram
@@ -122,13 +107,18 @@ nodeattrs
122107
nodesdn
123108
noops
124109
nori
110+
Nori
125111
nysiis
112+
ONNX
126113
opendistro
127114
opensearch
115+
OPENSEARCH
128116
opensearchproject
129117
opensearchstaging
130118
ords
119+
OSCPU
131120
oversample
121+
Oversample
132122
performanceanalyzer
133123
permissionsinfo
134124
pipefail
@@ -137,38 +127,54 @@ prirep
137127
rawfile
138128
readingform
139129
rebalance
130+
Rebalance
140131
recoverysource
141132
reindex
133+
Reindex
142134
relo
143135
reloadcerts
144136
remotestore
145137
rethrottle
138+
Rethrottle
146139
rolesmapping
140+
Rolespan
147141
rollup
142+
Rollup
148143
rollups
144+
Rollups
149145
romaji
150146
roundtrips
147+
Rudnick
151148
ruleset
152149
scriptless
153150
securityconfig
154151
slowlog
152+
Slowlog
155153
slurpfile
156154
snapshotted
157155
softmax
156+
Sorani
158157
sslinfo
159158
stoptags
160159
stopwords
160+
Stringifiedboolean
161+
Stringifiedinteger
161162
subqueries
162163
subschemas
163164
subword
165+
syserr
164166
tdigest
165167
tenantinfo
166168
termvectors
167169
tfidf
170+
Tfidf
171+
Tika
168172
tokenfilters
169173
translog
174+
Translog
170175
tubone
171176
unigrams
177+
Unmanaged
172178
unmatch
173179
untriaged
174180
updateable
@@ -177,7 +183,4 @@ urldecode
177183
vectory
178184
whoamiprotected
179185
wordnet
180-
datarows
181-
syserr
182-
cuserr
183-
Rudnick
186+
Yrtsd

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
5555
- Added `plugins` to NodeInfoSettings ([#442](https://github.com/opensearch-project/opensearch-api-specification/pull/442))
5656
- Added test coverage ([#443](https://github.com/opensearch-project/opensearch-api-specification/pull/443))
5757
- Added `--opensearch-version` to `merger` that excludes schema elements per semver ([#428](https://github.com/opensearch-project/opensearch-api-specification/pull/428))
58+
- Added `retry` to `tester` to support asynchronous tasks ([453](https://github.com/opensearch-project/opensearch-api-specification/pull/453))
5859

5960
### Changed
6061

TESTING_GUIDE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Simple Test Story](#simple-test-story)
66
- [Using Output from Previous Chapters](#using-output-from-previous-chapters)
77
- [Managing Versions](#managing-versions)
8+
- [Waiting for Tasks](#waiting-for-tasks)
89
<!-- TOC -->
910

1011
# Spec Testing Guide
@@ -153,3 +154,24 @@ It's common to add a feature to the next version of OpenSearch. When adding a ne
153154
```
154155
155156
The [integration test workflow](.github/workflows/test-spec.yml) runs a matrix of OpenSearch versions, including the next version. Please check whether the workflow needs an update when adding version-specific tests.
157+
158+
### Waiting for Tasks
159+
160+
Some APIs behave asynchronously and may require a test to wait for a task to complete. This can be achived with a combination of `payload` and `retry`.
161+
162+
For example, an ML task returns `CREATED` when created, and `COMPLETED` when it's done. The example below will retry 3 times with an interval of 30 seconds until the task is complete. The default wait time is 1s.
163+
164+
```yaml
165+
- synopsis: Wait for task.
166+
path: /_plugins/_ml/tasks/{task_id}
167+
method: GET
168+
parameters:
169+
task_id: ${create_model.task_id}
170+
response:
171+
status: 200
172+
payload:
173+
state: COMPLETED
174+
retry:
175+
count: 3
176+
wait: 30000
177+
```

json_schemas/test_story.schema.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ definitions:
8181
$ref: '#/definitions/Output'
8282
version:
8383
$ref: '#/definitions/Version'
84+
retry:
85+
$ref: '#/definitions/Retry'
8486
required: [method, path]
8587

8688
Output:
@@ -100,6 +102,21 @@ definitions:
100102
The semver range to execute the story or chapter against.
101103
type: string
102104

105+
Retry:
106+
description: |
107+
Number of times to retry on error.
108+
oneOf:
109+
- type: object
110+
properties:
111+
count:
112+
type: integer
113+
description: Number of retries.
114+
wait:
115+
type: integer
116+
description: Number of milliseconds to wait before retrying.
117+
required:
118+
- count
119+
103120
RequestBody:
104121
type: object
105122
properties:

0 commit comments

Comments
 (0)