File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed
tests/integration/tools/mongodb/search Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -118,24 +118,20 @@ describeWithMongoDB(
118
118
) ;
119
119
120
120
async function waitUntilSearchIsReady ( provider : NodeDriverServiceProvider , abortSignal : AbortSignal ) : Promise < void > {
121
- let success = false ;
122
121
let lastError : unknown = null ;
123
122
124
123
for ( let i = 0 ; i < SEARCH_RETRIES && ! abortSignal . aborted ; i ++ ) {
125
124
try {
126
125
await provider . insertOne ( "tmp" , "test" , { field1 : "yay" } ) ;
127
126
await provider . createSearchIndexes ( "tmp" , "test" , [ { definition : { mappings : { dynamic : true } } } ] ) ;
128
- success = true ;
129
- break ;
127
+ return ;
130
128
} catch ( err ) {
131
129
lastError = err ;
132
130
await sleep ( 100 ) ;
133
131
}
134
132
}
135
133
136
- if ( ! success ) {
137
- throw new Error ( `Search Management Index is not ready.\nlastError: ${ JSON . stringify ( lastError ) } ` ) ;
138
- }
134
+ throw new Error ( `Search Management Index is not ready.\nlastError: ${ JSON . stringify ( lastError ) } ` ) ;
139
135
}
140
136
141
137
async function waitUntilIndexIsQueryable (
@@ -145,7 +141,6 @@ async function waitUntilIndexIsQueryable(
145
141
indexName : string ,
146
142
abortSignal : AbortSignal
147
143
) : Promise < void > {
148
- let success = false ;
149
144
let lastIndexStatus : unknown = null ;
150
145
let lastError : unknown = null ;
151
146
@@ -155,20 +150,17 @@ async function waitUntilIndexIsQueryable(
155
150
lastIndexStatus = indexStatus ;
156
151
157
152
if ( indexStatus ?. queryable === true ) {
158
- success = true ;
159
- break ;
153
+ return ;
160
154
}
161
155
} catch ( err ) {
162
156
lastError = err ;
163
157
await sleep ( 100 ) ;
164
158
}
165
159
}
166
160
167
- if ( ! success ) {
168
- throw new Error (
169
- `Index ${ indexName } in ${ database } .${ collection } is not ready:
161
+ throw new Error (
162
+ `Index ${ indexName } in ${ database } .${ collection } is not ready:
170
163
lastIndexStatus: ${ JSON . stringify ( lastIndexStatus ) }
171
164
lastError: ${ JSON . stringify ( lastError ) } `
172
- ) ;
173
- }
165
+ ) ;
174
166
}
You can’t perform that action at this time.
0 commit comments