Improved cleanup yaml tests (#1306)

This commit is contained in:
Enrico Zimuel
2020-09-14 17:34:02 +02:00
committed by GitHub
parent d6d7aeffb3
commit 2894f14b7c

View File

@ -75,11 +75,7 @@ function build (opts = {}) {
}
try {
const { body: templates } = await client.indices.getTemplate()
await helper.runInParallel(
client, 'indices.deleteTemplate',
Object.keys(templates).map(t => ({ name: t }))
)
await client.indices.deleteTemplate({ name: '*' })
} catch (err) {
assert.ifError(err, 'should not error: indices.deleteTemplate')
}
@ -87,12 +83,7 @@ function build (opts = {}) {
try {
const { body: repositories } = await client.snapshot.getRepository()
for (const repository of Object.keys(repositories)) {
const { body: snapshots } = await client.snapshot.get({ repository, snapshot: '_all' })
await helper.runInParallel(
client, 'snapshot.delete',
Object.keys(snapshots).map(snapshot => ({ snapshot, repository })),
{ ignore: [404] }
)
await client.snapshot.delete({ repository, snapshot: '*' }, { ignore: [404] })
await client.snapshot.deleteRepository({ repository }, { ignore: [404] })
}
} catch (err) {