Skip to content

Commit 05f4606

Browse files
committed
Add unload command to certs test.
1 parent bcfb42f commit 05f4606

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

x-pack/test/api_integration/apis/uptime/rest/certs.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { CertType } from '../../../../../legacy/plugins/uptime/common/runtime_ty
1515
export default function({ getService }: FtrProviderContext) {
1616
const supertest = getService('supertest');
1717
const legacyEsService = getService('legacyEs');
18+
const esArchiver = getService('esArchiver');
1819

1920
describe('certs api', () => {
2021
describe('empty index', async () => {
@@ -23,6 +24,7 @@ export default function({ getService }: FtrProviderContext) {
2324
expect(JSON.stringify(apiResponse.body)).to.eql('{"certs":[]}');
2425
});
2526
});
27+
2628
describe('when data is present', async () => {
2729
const now = moment();
2830
const cnva = now.add(6, 'months').toISOString();
@@ -59,15 +61,21 @@ export default function({ getService }: FtrProviderContext) {
5961
d => d
6062
);
6163
});
64+
after('unload test docs', () => {
65+
esArchiver.unload('uptime/blank');
66+
});
6267

6368
it('pause so I can check stuff', async () => {
6469
const apiResponse = await supertest.get(API_URLS.CERTS);
6570
const { body } = apiResponse;
71+
6672
expect(body.certs).not.to.be(undefined);
6773
expect(Array.isArray(body.certs)).to.be(true);
6874
expect(body.certs).to.have.length(1);
75+
6976
const decoded = CertType.decode(body.certs[0]);
7077
expect(isRight(decoded)).to.be(true);
78+
7179
const cert = body.certs[0];
7280
expect(Array.isArray(cert.monitors)).to.be(true);
7381
expect(cert.monitors[0]).to.eql({ id: monitorId });

x-pack/test/api_integration/apis/uptime/rest/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function({ getService, loadTestFile }: FtrProviderContext) {
3737
});
3838

3939
describe('with generated data', () => {
40-
before('load heartbeat data', async () => await esArchiver.load('uptime/blank'));
40+
beforeEach('load heartbeat data', async () => await esArchiver.loadIfNeeded('uptime/blank'));
4141
after('unload', async () => await esArchiver.unload('uptime/blank'));
4242

4343
loadTestFile(require.resolve('./certs'));

0 commit comments

Comments
 (0)