Skip to content

Commit

Permalink
[FTR] Use importExport for saved_object/basic archive (elastic#100244)
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
  • Loading branch information
Tyler Smalley committed Jun 13, 2021
1 parent 73225da commit e0f9ad7
Show file tree
Hide file tree
Showing 15 changed files with 112 additions and 108 deletions.
16 changes: 8 additions & 8 deletions test/api_integration/apis/kql_telemetry/kql_telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ export default function ({ getService }: FtrProviderContext) {
const es = getService('es');

describe('telemetry API', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should increment the opt *in* counter in the .kibana/kql-telemetry document', async () => {
await supertest
Expand Down
8 changes: 4 additions & 4 deletions test/api_integration/apis/saved_objects/bulk_get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export default function ({ getService }: FtrProviderContext) {
);
});

after(() =>
kibanaServer.importExport.unload(
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 200 with individual responses', async () =>
await supertest
Expand Down
16 changes: 8 additions & 8 deletions test/api_integration/apis/saved_objects/bulk_update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ export default function ({ getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');

describe('bulkUpdate', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 200', async () => {
const response = await supertest
Expand Down
8 changes: 4 additions & 4 deletions test/api_integration/apis/saved_objects/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ export default function ({ getService }: FtrProviderContext) {
);
});

after(() =>
kibanaServer.importExport.unload(
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 200', async () => {
await supertest
Expand Down
16 changes: 8 additions & 8 deletions test/api_integration/apis/saved_objects/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ export default function ({ getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');

describe('delete', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 200 when deleting a doc', async () =>
await supertest
Expand Down
4 changes: 4 additions & 0 deletions test/api_integration/apis/saved_objects/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,10 @@ export default function ({ getService }: FtrProviderContext) {
const objects = ndjsonToObject(resp.text);
expect(objects.length).to.eql(10001);
});
await supertest
// @ts-expect-error TS complains about using `anotherCustomVisId` before it is assigned
.delete(`/s/${SPACE_ID}/api/saved_objects/visualization/${anotherCustomVisId}`)
.expect(200);
});

it('should return 400 when exporting more than allowed by maxImportExportSize', async () => {
Expand Down
8 changes: 4 additions & 4 deletions test/api_integration/apis/saved_objects/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ export default function ({ getService }: FtrProviderContext) {
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
);
});
after(() =>
kibanaServer.importExport.unload(
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 200', async () =>
await supertest
Expand Down
16 changes: 8 additions & 8 deletions test/api_integration/apis/saved_objects/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ export default function ({ getService }: FtrProviderContext) {
};

describe('with basic data existing', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 415 when no file passed in', async () => {
await supertest
Expand Down
16 changes: 8 additions & 8 deletions test/api_integration/apis/saved_objects/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ export default function ({ getService }: FtrProviderContext) {
});

describe('with kibana index', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 200', async () =>
await supertest
Expand Down
16 changes: 8 additions & 8 deletions test/api_integration/apis/saved_objects/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ export default function ({ getService }: FtrProviderContext) {
const kibanaServer = getService('kibanaServer');

describe('update', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});
it('should return 200', async () => {
await supertest
.put(`/api/saved_objects/visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab`)
Expand Down
32 changes: 16 additions & 16 deletions test/api_integration/apis/saved_objects_management/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ export default function ({ getService }: FtrProviderContext) {
});

describe('with kibana index', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 200 with individual responses', async () =>
await supertest
Expand Down Expand Up @@ -93,16 +93,16 @@ export default function ({ getService }: FtrProviderContext) {
});

describe('`hasReference` and `hasReferenceOperator` parameters', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/references.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/references.json'
)
);
);
});

it('search for a reference', async () => {
await supertest
Expand Down
16 changes: 8 additions & 8 deletions test/api_integration/apis/saved_objects_management/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ export default function ({ getService }: FtrProviderContext) {
const existingObject = 'visualization/dd7caf20-9efd-11e7-acb3-3dab96693fab';
const nonexistentObject = 'wigwags/foo';

before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('should return 200 for object that exists and inject metadata', async () =>
await supertest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ export default function ({ getService }: FtrProviderContext) {
});

describe('relationships', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/management/saved_objects/relationships.json'
)
);
);
});

const baseApiUrl = `/api/kibana/management/saved_objects/relationships`;
const defaultTypes = ['visualization', 'index-pattern', 'search', 'dashboard'];
Expand Down
16 changes: 8 additions & 8 deletions test/api_integration/apis/shorten/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ export default function ({ getService }) {
const kibanaServer = getService('kibanaServer');

describe('url shortener', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

it('generates shortened urls', async () => {
const resp = await supertest
Expand Down
16 changes: 8 additions & 8 deletions test/api_integration/apis/stats/stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ export default function ({ getService }) {
const kibanaServer = getService('kibanaServer');

describe('kibana stats api', () => {
before(() =>
kibanaServer.importExport.load(
before(async () => {
await kibanaServer.importExport.load(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
after(() =>
kibanaServer.importExport.unload(
);
});
after(async () => {
await kibanaServer.importExport.unload(
'test/api_integration/fixtures/kbn_archiver/saved_objects/basic.json'
)
);
);
});

describe('basic', () => {
it('should return the stats without cluster_uuid with no query string params', () => {
Expand Down

0 comments on commit e0f9ad7

Please sign in to comment.