Skip to content

Commit 9debc94

Browse files
committed
test: fix index deletion during integraton test teardown
Was assuming permissions the user will not have on hidden indices
1 parent 0c9e6b1 commit 9debc94

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

test/integration/test-runner.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -824,12 +824,15 @@ function isNDJson (api) {
824824
* Hack around the fact that serverless doesn't allow deleting indices using wildcards
825825
*/
826826
async function deleteIndices(client) {
827-
const indices = await client.cat.indices()
828-
if (indices.length > 0) {
829-
const indexNames = indices.map(index => index.name)
827+
const indicesRaw = await client.cat.indices()
828+
const indexNames = indicesRaw
829+
.trim()
830+
.split('\n')
831+
.map(row => row.split(' ')[2])
832+
.filter(name => !name.startsWith('.'))
833+
if (indexNames.length > 0) {
830834
await client.indices.delete({
831835
index: indexNames.join(','),
832-
expand_wildcards: 'open,closed,hidden',
833836
}, { ignore: [404] })
834837
}
835838
}

0 commit comments

Comments
 (0)