Updated cleanup code

This commit is contained in:
delvedor
2019-07-10 17:56:21 +02:00
parent 2798024031
commit 958e1ef9ca

View File

@ -84,16 +84,8 @@ class TestRunner {
} }
try { try {
const { body: repositories } = await this.client.snapshot.getRepository() await this.client.snapshot.delete({ repository: '*', snapshot: '*' }, { ignore: 404 })
for (const repository of Object.keys(repositories)) { await this.client.snapshot.deleteRepository({ repository: '*' }, { ignore: 404 })
const { body: snapshots } = await this.client.snapshot.get({ repository, snapshot: '_all' })
await helper.runInParallel(
this.client, 'snapshot.delete',
Object.keys(snapshots).map(snapshot => ({ snapshot, repository })),
{ ignore: [404] }
)
await this.client.snapshot.deleteRepository({ repository }, { ignore: [404] })
}
} catch (err) { } catch (err) {
this.tap.error(err, 'should not error: snapshot.delete / snapshot.deleteRepository') this.tap.error(err, 'should not error: snapshot.delete / snapshot.deleteRepository')
} }