Skip to content

Commit

Permalink
Get rid of esArchiver in the Copy To Spaces integration tests. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
azasypkin authored Sep 13, 2022
1 parent 8221714 commit 886d61a
Show file tree
Hide file tree
Showing 14 changed files with 958 additions and 522 deletions.
15 changes: 15 additions & 0 deletions x-pack/test/common/services/spaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import type { Space } from '@kbn/spaces-plugin/common';
import Axios from 'axios';
import { format as formatUrl } from 'url';
import util from 'util';
Expand Down Expand Up @@ -46,5 +47,19 @@ export function SpacesServiceProvider({ getService }: FtrProviderContext) {
}
log.debug(`deleted space id: ${spaceId}`);
}

public async getAll() {
log.debug('retrieving all spaces');
const { data, status, statusText } = await axios.get<Space[]>('/api/spaces/space');

if (status !== 200) {
throw new Error(
`Expected status code of 200, received ${status} ${statusText}: ${util.inspect(data)}`
);
}
log.debug(`retrieved ${data.length} spaces`);

return data;
}
})();
}
24 changes: 20 additions & 4 deletions x-pack/test/functional/apps/spaces/copy_saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,28 @@
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

export default function spaceSelectorFunctonalTests({
export default function spaceSelectorFunctionalTests({
getService,
getPageObjects,
}: FtrProviderContext) {
const esArchiver = getService('esArchiver');
const kbnServer = getService('kibanaServer');
const spaces = getService('spaces');
const testSubjects = getService('testSubjects');
const PageObjects = getPageObjects(['security', 'settings', 'copySavedObjectsToSpace']);
const log = getService('log');

describe('Copy Saved Objects to Space', function () {
before(async () => {
await esArchiver.load('x-pack/test/functional/es_archives/spaces/copy_saved_objects');
log.debug('Loading test data for the following spaces: default, sales');
await Promise.all([
kbnServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/spaces/copy_saved_objects_default_space.json'
),
kbnServer.importExport.load(
'x-pack/test/functional/fixtures/kbn_archiver/spaces/copy_saved_objects_sales_space.json',
{ space: 'sales' }
),
]);

await spaces.create({
id: 'marketing',
Expand All @@ -43,9 +53,15 @@ export default function spaceSelectorFunctonalTests({
});

after(async () => {
log.debug('Removing data from the following spaces: default, sales');
await Promise.all(
['default', 'sales'].map((spaceId) =>
kbnServer.savedObjects.cleanStandardList({ space: spaceId })
)
);

await spaces.delete('sales');
await spaces.delete('marketing');
await esArchiver.unload('x-pack/test/functional/es_archives/spaces/copy_saved_objects');
});

it('allows a dashboard to be copied to the marketing space, with all references', async () => {
Expand Down
171 changes: 0 additions & 171 deletions x-pack/test/functional/es_archives/spaces/copy_saved_objects/data.json

This file was deleted.

This file was deleted.

Loading

0 comments on commit 886d61a

Please sign in to comment.