mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Get rid of esArchiver
in the Copy To Spaces
integration tests. (#137831)
This commit is contained in:
parent
82217146ed
commit
886d61ae72
14 changed files with 958 additions and 522 deletions
|
@ -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';
|
||||
|
@ -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;
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
@ -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 () => {
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,293 +0,0 @@
|
|||
{
|
||||
"type": "index",
|
||||
"value": {
|
||||
"aliases": {
|
||||
".kibana": {}
|
||||
},
|
||||
"index": ".kibana_1",
|
||||
"mappings": {
|
||||
"dynamic": "strict",
|
||||
"properties": {
|
||||
"migrationVersion": {
|
||||
"dynamic": "true",
|
||||
"properties": {
|
||||
"index-pattern": {
|
||||
"type": "text",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"dynamic": "true",
|
||||
"properties": {
|
||||
"buildNum": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"dateFormat:tz": {
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"ignore_above": 256,
|
||||
"type": "keyword"
|
||||
}
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
"defaultIndex": {
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"ignore_above": 256,
|
||||
"type": "keyword"
|
||||
}
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
"notifications:lifetime:banner": {
|
||||
"type": "long"
|
||||
},
|
||||
"notifications:lifetime:error": {
|
||||
"type": "long"
|
||||
},
|
||||
"notifications:lifetime:info": {
|
||||
"type": "long"
|
||||
},
|
||||
"notifications:lifetime:warning": {
|
||||
"type": "long"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dashboard": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"hits": {
|
||||
"type": "integer"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optionsJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"panelsJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"refreshInterval": {
|
||||
"properties": {
|
||||
"display": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"pause": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"section": {
|
||||
"type": "integer"
|
||||
},
|
||||
"value": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeFrom": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"timeRestore": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"timeTo": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"uiStateJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"index-pattern": {
|
||||
"properties": {
|
||||
"fieldFormatMap": {
|
||||
"type": "text"
|
||||
},
|
||||
"fields": {
|
||||
"type": "text"
|
||||
},
|
||||
"intervalName": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"notExpandable": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"sourceFilters": {
|
||||
"type": "text"
|
||||
},
|
||||
"timeFieldName": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"search": {
|
||||
"properties": {
|
||||
"columns": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"hits": {
|
||||
"type": "integer"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sort": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
},
|
||||
"server": {
|
||||
"properties": {
|
||||
"uuid": {
|
||||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "date"
|
||||
},
|
||||
"url": {
|
||||
"properties": {
|
||||
"accessCount": {
|
||||
"type": "long"
|
||||
},
|
||||
"accessDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"createDate": {
|
||||
"type": "date"
|
||||
},
|
||||
"url": {
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"ignore_above": 2048,
|
||||
"type": "keyword"
|
||||
}
|
||||
},
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"visualization": {
|
||||
"properties": {
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"kibanaSavedObjectMeta": {
|
||||
"properties": {
|
||||
"searchSourceJSON": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"savedSearchId": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"title": {
|
||||
"type": "text"
|
||||
},
|
||||
"uiStateJSON": {
|
||||
"type": "text"
|
||||
},
|
||||
"version": {
|
||||
"type": "integer"
|
||||
},
|
||||
"visState": {
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"namespace": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"space": {
|
||||
"properties": {
|
||||
"_reserved": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"color": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"description": {
|
||||
"type": "text"
|
||||
},
|
||||
"disabledFeatures": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"initials": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"name": {
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"ignore_above": 2048,
|
||||
"type": "keyword"
|
||||
}
|
||||
},
|
||||
"type": "text"
|
||||
}
|
||||
}
|
||||
},
|
||||
"references": {
|
||||
"type": "nested",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"type": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"id": {
|
||||
"type": "keyword"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"settings": {
|
||||
"index": {
|
||||
"auto_expand_replicas": "0-1",
|
||||
"number_of_replicas": "0",
|
||||
"number_of_shards": "1"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -41,6 +41,7 @@ export function createTestConfig(name: string, options: CreateTestConfigOptions)
|
|||
retry: config.xpack.api.get('services.retry'),
|
||||
esArchiver: config.kibana.functional.get('services.esArchiver'),
|
||||
kibanaServer: config.kibana.functional.get('services.kibanaServer'),
|
||||
spaces: config.xpack.api.get('services.spaces'),
|
||||
},
|
||||
junit: {
|
||||
reportName: 'X-Pack Spaces API Integration Tests -- ' + name,
|
||||
|
|
|
@ -0,0 +1,330 @@
|
|||
{
|
||||
"attributes": {
|
||||
"title": "Copy to Space index pattern 1 from default space"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_ip_1_default",
|
||||
"migrationVersion": {
|
||||
"index-pattern": "8.0.0"
|
||||
},
|
||||
"originId": "cts_ip_1",
|
||||
"references": [],
|
||||
"type": "index-pattern",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyOCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"description": "AreaChart",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
},
|
||||
"title": "CTS vis 1 from default space",
|
||||
"uiStateJSON": "{}",
|
||||
"version": 1,
|
||||
"visState": "{\"title\":\"New Visualization\",\"type\":\"area\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"smoothLines\":false,\"scale\":\"linear\",\"interpolate\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{},\"legendSize\":\"auto\"},\"aggs\":[{\"id\":\"1\",\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1,\"extended_bounds\":{}}}],\"listeners\":{}}"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_vis_1_default",
|
||||
"migrationVersion": {
|
||||
"visualization": "8.3.0"
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"id": "cts_ip_1_default",
|
||||
"name": "CTS IP 1",
|
||||
"type": "index-pattern"
|
||||
}
|
||||
],
|
||||
"type": "visualization",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyMSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"description": "AreaChart",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
},
|
||||
"title": "CTS vis 2 from default space",
|
||||
"uiStateJSON": "{}",
|
||||
"version": 1,
|
||||
"visState": "{\"title\":\"New Visualization\",\"type\":\"area\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"smoothLines\":false,\"scale\":\"linear\",\"interpolate\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{},\"legendSize\":\"auto\"},\"aggs\":[{\"id\":\"1\",\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1,\"extended_bounds\":{}}}],\"listeners\":{}}"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_vis_2_default",
|
||||
"migrationVersion": {
|
||||
"visualization": "8.3.0"
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"id": "cts_ip_1_default",
|
||||
"name": "CTS IP 1",
|
||||
"type": "index-pattern"
|
||||
}
|
||||
],
|
||||
"type": "visualization",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyMiwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"description": "AreaChart",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
},
|
||||
"title": "CTS vis 3 from default space",
|
||||
"uiStateJSON": "{}",
|
||||
"version": 1,
|
||||
"visState": "{\"title\":\"New Visualization\",\"type\":\"area\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"smoothLines\":false,\"scale\":\"linear\",\"interpolate\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{},\"legendSize\":\"auto\"},\"aggs\":[{\"id\":\"1\",\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1,\"extended_bounds\":{}}}],\"listeners\":{}}"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_vis_3_default",
|
||||
"migrationVersion": {
|
||||
"visualization": "8.3.0"
|
||||
},
|
||||
"originId": "cts_vis_3",
|
||||
"references": [
|
||||
{
|
||||
"id": "cts_ip_1_default",
|
||||
"name": "CTS IP 1",
|
||||
"type": "index-pattern"
|
||||
}
|
||||
],
|
||||
"type": "visualization",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyMywxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"description": "Copy to Space Dashboard from the default space",
|
||||
"title": "This is the default test space CTS dashboard"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_dashboard_default",
|
||||
"migrationVersion": {
|
||||
"dashboard": "8.4.0"
|
||||
},
|
||||
"originId": "cts_dashboard",
|
||||
"references": [
|
||||
{
|
||||
"id": "cts_vis_1_default",
|
||||
"name": "CTS Vis 1",
|
||||
"type": "visualization"
|
||||
},
|
||||
{
|
||||
"id": "cts_vis_2_default",
|
||||
"name": "CTS Vis 2",
|
||||
"type": "visualization"
|
||||
},
|
||||
{
|
||||
"id": "cts_vis_3_default",
|
||||
"name": "CTS Vis 3",
|
||||
"type": "visualization"
|
||||
}
|
||||
],
|
||||
"type": "dashboard",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyMCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in one space"
|
||||
},
|
||||
"id": "conflict_2_default",
|
||||
"originId": "conflict_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUxMCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in all spaces"
|
||||
},
|
||||
"id": "conflict_2_all",
|
||||
"originId": "conflict_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUxMSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test an inexact match conflict for an originId -> id match"
|
||||
},
|
||||
"id": "conflict_1b_default",
|
||||
"originId": "conflict_1b_space_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUwMywxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test an inexact match conflict for an originId -> originId match"
|
||||
},
|
||||
"id": "conflict_1a_default",
|
||||
"originId": "conflict_1a",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUwMCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "Some title"
|
||||
},
|
||||
"id": "my_isolated_object",
|
||||
"references": [],
|
||||
"type": "isolatedtype",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzQ4NywxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in all spaces"
|
||||
},
|
||||
"id": "all_spaces",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5NywxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in one space"
|
||||
},
|
||||
"id": "default_only",
|
||||
"references": [
|
||||
{
|
||||
"id": "each_space",
|
||||
"name": "refname",
|
||||
"type": "sharedtype"
|
||||
}
|
||||
],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ4OCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in the default, space_1, and space_2 spaces"
|
||||
},
|
||||
"id": "each_space",
|
||||
"references": [
|
||||
{
|
||||
"id": "default_only",
|
||||
"name": "refname",
|
||||
"type": "sharedtype"
|
||||
},
|
||||
{
|
||||
"id": "space_1_only",
|
||||
"name": "refname",
|
||||
"type": "sharedtype"
|
||||
},
|
||||
{
|
||||
"id": "space_2_only",
|
||||
"name": "refname",
|
||||
"type": "sharedtype"
|
||||
},
|
||||
{
|
||||
"id": "all_spaces",
|
||||
"name": "refname",
|
||||
"type": "sharedtype"
|
||||
}
|
||||
],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5NiwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test an inexact match conflict for an id -> originId match"
|
||||
},
|
||||
"id": "conflict_1c_default_and_space_1",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUwNiwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in the default and space_1 spaces"
|
||||
},
|
||||
"id": "default_and_space_1",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5MywxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in the default and space_2 spaces"
|
||||
},
|
||||
"id": "default_and_space_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5NCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This object only exists to test the third assertion for spacesWithMatchingOrigins in get_shareable_references"
|
||||
},
|
||||
"id": "space_2_only_matching_origin",
|
||||
"originId": "space_2_only",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5MiwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test that when an object is unshared from a space, inbound aliases for just those spaces are removed"
|
||||
},
|
||||
"id": "alias_delete_inclusive",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5OCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test that when an object is unshared from all space, inbound aliases for all spaces are removed"
|
||||
},
|
||||
"id": "alias_delete_exclusive",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5OSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in the space_1 and space_2 spaces"
|
||||
},
|
||||
"id": "space_1_and_space_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5NSwxXQ=="
|
||||
}
|
|
@ -0,0 +1,197 @@
|
|||
{
|
||||
"attributes": {
|
||||
"title": "Copy to Space index pattern 1 from space_1 space"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_ip_1_space_1",
|
||||
"migrationVersion": {
|
||||
"index-pattern": "8.0.0"
|
||||
},
|
||||
"originId": "cts_ip_1",
|
||||
"references": [],
|
||||
"type": "index-pattern",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyOSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"description": "AreaChart",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
},
|
||||
"title": "CTS vis 1 from space_1 space",
|
||||
"uiStateJSON": "{}",
|
||||
"version": 1,
|
||||
"visState": "{\"title\":\"New Visualization\",\"type\":\"area\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"smoothLines\":false,\"scale\":\"linear\",\"interpolate\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{}},\"aggs\":[{\"id\":\"1\",\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"customInterval\":\"2h\",\"min_doc_count\":1,\"extended_bounds\":{}}}],\"listeners\":{}}"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_vis_1_space_1",
|
||||
"migrationVersion": {
|
||||
"visualization": "8.3.0"
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"id": "cts_ip_1_space_1",
|
||||
"name": "CTS IP 1",
|
||||
"type": "index-pattern"
|
||||
}
|
||||
],
|
||||
"type": "visualization",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyMSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"description": "AreaChart",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
},
|
||||
"title": "CTS vis 2 from space_1 space",
|
||||
"uiStateJSON": "{}",
|
||||
"version": 1,
|
||||
"visState": "{\"title\":\"New Visualization\",\"type\":\"area\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"smoothLines\":false,\"scale\":\"linear\",\"interpolate\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{},\"legendSize\":\"auto\"},\"aggs\":[{\"id\":\"1\",\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1,\"extended_bounds\":{}}}],\"listeners\":{}}"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_vis_2_space_1",
|
||||
"migrationVersion": {
|
||||
"visualization": "8.3.0"
|
||||
},
|
||||
"references": [
|
||||
{
|
||||
"id": "cts_ip_1_space_1",
|
||||
"name": "CTS IP 1",
|
||||
"type": "index-pattern"
|
||||
}
|
||||
],
|
||||
"type": "visualization",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyNiwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"description": "AreaChart",
|
||||
"kibanaSavedObjectMeta": {
|
||||
"searchSourceJSON": "{}"
|
||||
},
|
||||
"title": "CTS vis 3 from space_1 space",
|
||||
"uiStateJSON": "{}",
|
||||
"version": 1,
|
||||
"visState": "{\"title\":\"New Visualization\",\"type\":\"area\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"smoothLines\":false,\"scale\":\"linear\",\"interpolate\":\"linear\",\"mode\":\"stacked\",\"times\":[],\"addTimeMarker\":false,\"defaultYExtents\":false,\"setYExtents\":false,\"yAxis\":{},\"legendSize\":\"auto\"},\"aggs\":[{\"id\":\"1\",\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"@timestamp\",\"interval\":\"auto\",\"min_doc_count\":1,\"extended_bounds\":{}}}],\"listeners\":{}}"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_vis_3_space_1",
|
||||
"migrationVersion": {
|
||||
"visualization": "8.3.0"
|
||||
},
|
||||
"originId": "cts_vis_3",
|
||||
"references": [
|
||||
{
|
||||
"id": "cts_ip_1_space_1",
|
||||
"name": "CTS IP 1",
|
||||
"type": "index-pattern"
|
||||
}
|
||||
],
|
||||
"type": "visualization",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyNywxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"description": "Copy to Space Dashboard from space_1 space",
|
||||
"title": "This is the space_1 test space CTS dashboard"
|
||||
},
|
||||
"coreMigrationVersion": "8.4.0",
|
||||
"id": "cts_dashboard_space_1",
|
||||
"migrationVersion": {
|
||||
"dashboard": "8.4.0"
|
||||
},
|
||||
"originId": "cts_dashboard",
|
||||
"references": [
|
||||
{
|
||||
"id": "cts_vis_1_space_1",
|
||||
"name": "CTS Vis 1",
|
||||
"type": "visualization"
|
||||
},
|
||||
{
|
||||
"id": "cts_vis_2_space_1",
|
||||
"name": "CTS Vis 2",
|
||||
"type": "visualization"
|
||||
},
|
||||
{
|
||||
"id": "cts_vis_3_space_1",
|
||||
"name": "CTS Vis 3",
|
||||
"type": "visualization"
|
||||
}
|
||||
],
|
||||
"type": "dashboard",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzUyNCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in one space"
|
||||
},
|
||||
"id": "conflict_2_space_1",
|
||||
"originId": "conflict_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUxMCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test an inexact match conflict for an originId -> id match"
|
||||
},
|
||||
"id": "conflict_1b_space_1",
|
||||
"originId": "conflict_1b_space_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUwNCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test an inexact match conflict for an originId -> originId match"
|
||||
},
|
||||
"id": "conflict_1a_space_1",
|
||||
"originId": "conflict_1a",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUwMSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in one space"
|
||||
},
|
||||
"id": "space_1_only",
|
||||
"references": [
|
||||
{
|
||||
"id": "each_space",
|
||||
"name": "refname",
|
||||
"type": "sharedtype"
|
||||
}
|
||||
],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ4OSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "Some title"
|
||||
},
|
||||
"id": "my_isolated_object",
|
||||
"references": [],
|
||||
"type": "isolatedtype",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzQ4NywxXQ=="
|
||||
}
|
|
@ -0,0 +1,74 @@
|
|||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in one space"
|
||||
},
|
||||
"id": "conflict_2_space_2",
|
||||
"originId": "conflict_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUxMCwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test an inexact match conflict for an id -> originId match"
|
||||
},
|
||||
"id": "conflict_1c_space_2",
|
||||
"originId": "conflict_1c_default_and_space_1",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUwNywxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test an inexact match conflict for an originId -> id match"
|
||||
},
|
||||
"id": "conflict_1b_space_2",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUwNSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "This is used to test an inexact match conflict for an originId -> originId match"
|
||||
},
|
||||
"id": "conflict_1a_space_2",
|
||||
"originId": "conflict_1a",
|
||||
"references": [],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzUwMiwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "A shared saved-object in one space"
|
||||
},
|
||||
"id": "space_2_only",
|
||||
"references": [
|
||||
{
|
||||
"id": "each_space",
|
||||
"name": "refname",
|
||||
"type": "sharedtype"
|
||||
}
|
||||
],
|
||||
"type": "sharedtype",
|
||||
"updated_at": "2017-09-21T18:59:16.270Z",
|
||||
"version": "WzQ5MSwxXQ=="
|
||||
}
|
||||
|
||||
{
|
||||
"attributes": {
|
||||
"title": "Some title"
|
||||
},
|
||||
"id": "my_isolated_object",
|
||||
"references": [],
|
||||
"type": "isolatedtype",
|
||||
"updated_at": "2017-09-21T18:49:16.270Z",
|
||||
"version": "WzQ4NywxXQ=="
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
const SPACE_1 = {
|
||||
id: 'space_1',
|
||||
name: 'Space 1',
|
||||
description: 'This is the first test space',
|
||||
disabledFeatures: [],
|
||||
};
|
||||
|
||||
const SPACE_2 = {
|
||||
id: 'space_2',
|
||||
name: 'Space 2',
|
||||
description: 'This is the second test space',
|
||||
disabledFeatures: [],
|
||||
};
|
||||
|
||||
// Objects can only be imported in one space at a time. To have test saved objects
|
||||
// that are shared in multiple spaces we should import all objects in the "original"
|
||||
// spaces first and then share them to other spaces as a subsequent operation.
|
||||
const OBJECTS_TO_SHARE: Array<{
|
||||
spacesToAdd?: string[];
|
||||
spacesToRemove?: string[];
|
||||
objects: Array<{ type: string; id: string }>;
|
||||
}> = [
|
||||
{
|
||||
spacesToAdd: ['*'],
|
||||
spacesToRemove: ['default'],
|
||||
objects: [
|
||||
{ type: 'sharedtype', id: 'all_spaces' },
|
||||
{ type: 'sharedtype', id: 'space_2_only_matching_origin' },
|
||||
{ type: 'sharedtype', id: 'alias_delete_exclusive' },
|
||||
],
|
||||
},
|
||||
{
|
||||
spacesToRemove: ['default'],
|
||||
spacesToAdd: [SPACE_1.id, SPACE_2.id],
|
||||
objects: [{ type: 'sharedtype', id: 'space_1_and_space_2' }],
|
||||
},
|
||||
{
|
||||
spacesToAdd: [SPACE_1.id, SPACE_2.id],
|
||||
objects: [
|
||||
{ type: 'sharedtype', id: 'each_space' },
|
||||
{ type: 'sharedtype', id: 'conflict_2_all' },
|
||||
{ type: 'sharedtype', id: 'alias_delete_inclusive' },
|
||||
],
|
||||
},
|
||||
{
|
||||
spacesToAdd: [SPACE_1.id],
|
||||
objects: [
|
||||
{ type: 'sharedtype', id: 'conflict_1c_default_and_space_1' },
|
||||
{ type: 'sharedtype', id: 'default_and_space_1' },
|
||||
],
|
||||
},
|
||||
{
|
||||
spacesToAdd: [SPACE_2.id],
|
||||
objects: [{ type: 'sharedtype', id: 'default_and_space_2' }],
|
||||
},
|
||||
];
|
||||
|
||||
export function getTestDataLoader({ getService }: FtrProviderContext) {
|
||||
const spacesService = getService('spaces');
|
||||
const kbnServer = getService('kibanaServer');
|
||||
const supertest = getService('supertest');
|
||||
const log = getService('log');
|
||||
|
||||
return {
|
||||
before: async () => {
|
||||
await Promise.all([await spacesService.create(SPACE_1), await spacesService.create(SPACE_2)]);
|
||||
},
|
||||
|
||||
after: async () => {
|
||||
await Promise.all([spacesService.delete(SPACE_1.id), spacesService.delete(SPACE_2.id)]);
|
||||
},
|
||||
|
||||
beforeEach: async () => {
|
||||
log.debug('Loading test data for the following spaces: default, space_1 and space_2');
|
||||
await Promise.all([
|
||||
kbnServer.importExport.load(
|
||||
'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/default_space.json'
|
||||
),
|
||||
kbnServer.importExport.load(
|
||||
'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_1.json',
|
||||
{ space: SPACE_1.id }
|
||||
),
|
||||
kbnServer.importExport.load(
|
||||
'x-pack/test/spaces_api_integration/common/fixtures/kbn_archiver/space_2.json',
|
||||
{ space: SPACE_2.id }
|
||||
),
|
||||
]);
|
||||
|
||||
// Adjust spaces for the imported saved objects.
|
||||
for (const { objects, spacesToAdd = [], spacesToRemove = [] } of OBJECTS_TO_SHARE) {
|
||||
log.debug(
|
||||
`Updating spaces for the following objects (add: [${spacesToAdd.join(
|
||||
', '
|
||||
)}], remove: [${spacesToRemove.join(', ')}]): ${objects
|
||||
.map(({ type, id }) => `${type}:${id}`)
|
||||
.join(', ')}`
|
||||
);
|
||||
await supertest
|
||||
.post('/api/spaces/_update_objects_spaces')
|
||||
.send({ objects, spacesToAdd, spacesToRemove })
|
||||
.expect(200);
|
||||
}
|
||||
},
|
||||
|
||||
afterEach: async () => {
|
||||
const allSpacesIds = [
|
||||
...(await spacesService.getAll()).map((space) => space.id),
|
||||
'non_existent_space',
|
||||
];
|
||||
log.debug(`Removing data from the following spaces: ${allSpacesIds.join(', ')}`);
|
||||
await Promise.all(
|
||||
allSpacesIds.flatMap((spaceId) => [
|
||||
kbnServer.savedObjects.cleanStandardList({ space: spaceId }),
|
||||
kbnServer.savedObjects.clean({ space: spaceId, types: ['sharedtype', 'isolatedtype'] }),
|
||||
])
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
|
@ -6,13 +6,16 @@
|
|||
*/
|
||||
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
|
||||
import expect from '@kbn/expect';
|
||||
import { SuperTest } from 'supertest';
|
||||
import { EsArchiver } from '@kbn/es-archiver';
|
||||
import type { Client } from '@elastic/elasticsearch';
|
||||
import { DEFAULT_SPACE_ID } from '@kbn/spaces-plugin/common/constants';
|
||||
import { CopyResponse } from '@kbn/spaces-plugin/server/lib/copy_to_spaces';
|
||||
import {
|
||||
SavedObjectsImportFailure,
|
||||
SavedObjectsImportAmbiguousConflictError,
|
||||
} from '@kbn/core/server';
|
||||
import { getAggregatedSpaceData, getUrlPrefix } from '../lib/space_test_utils';
|
||||
import { DescribeFn, TestDefinitionAuthentication } from '../lib/types';
|
||||
import { getTestDataLoader } from '../lib/test_data_loader';
|
||||
import { FtrProviderContext } from '../ftr_provider_context';
|
||||
|
||||
type TestResponse = Record<string, any>;
|
||||
|
||||
|
@ -78,11 +81,11 @@ const getDestinationWithConflicts = (originSpaceId?: string) =>
|
|||
interface Aggs extends estypes.AggregationsMultiBucketAggregateBase {
|
||||
buckets: SpaceBucket[];
|
||||
}
|
||||
export function copyToSpaceTestSuiteFactory(
|
||||
es: Client,
|
||||
esArchiver: EsArchiver,
|
||||
supertest: SuperTest<any>
|
||||
) {
|
||||
export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
|
||||
const testDataLoader = getTestDataLoader(context);
|
||||
const supertestWithoutAuth = context.getService('supertestWithoutAuth');
|
||||
const es = context.getService('es');
|
||||
|
||||
const collectSpaceContents = async () => {
|
||||
const response = await getAggregatedSpaceData(es, [
|
||||
'visualization',
|
||||
|
@ -693,18 +696,22 @@ export function copyToSpaceTestSuiteFactory(
|
|||
if (createNewCopies) {
|
||||
expectNewCopyResponse(response, ambiguousConflictId, title);
|
||||
} else {
|
||||
// The `updatedAt` values cannot be determined upfront and hence asserted since we update spaces list
|
||||
// for certain objects in the test setup.
|
||||
const importAmbiguousConflictError = (errors as SavedObjectsImportFailure[])?.[0]
|
||||
.error as SavedObjectsImportAmbiguousConflictError;
|
||||
// It doesn't matter if overwrite is enabled or not, the object will not be copied because there are two matches in the destination space
|
||||
const destinations = [
|
||||
// response destinations should be sorted by updatedAt in descending order, then ID in ascending order
|
||||
// response destinations should be sorted by ID in ascending order
|
||||
{
|
||||
id: 'conflict_2_all',
|
||||
title: 'A shared saved-object in all spaces',
|
||||
updatedAt: '2017-09-21T18:59:16.270Z',
|
||||
updatedAt: importAmbiguousConflictError?.destinations[0].updatedAt,
|
||||
},
|
||||
{
|
||||
id: 'conflict_2_space_2',
|
||||
title: 'A shared saved-object in one space',
|
||||
updatedAt: '2017-09-21T18:59:16.270Z',
|
||||
updatedAt: importAmbiguousConflictError?.destinations[1].updatedAt,
|
||||
},
|
||||
];
|
||||
expect(success).to.eql(false);
|
||||
|
@ -737,22 +744,20 @@ export function copyToSpaceTestSuiteFactory(
|
|||
{ user = {}, spaceId = DEFAULT_SPACE_ID, tests }: CopyToSpaceTestDefinition
|
||||
) => {
|
||||
describeFn(description, () => {
|
||||
before(() => {
|
||||
before(async () => {
|
||||
// test data only allows for the following spaces as the copy origin
|
||||
expect(['default', 'space_1']).to.contain(spaceId);
|
||||
|
||||
await testDataLoader.before();
|
||||
});
|
||||
|
||||
after(async () => {
|
||||
await testDataLoader.after();
|
||||
});
|
||||
|
||||
describe('single-namespace types', () => {
|
||||
beforeEach(() =>
|
||||
esArchiver.load(
|
||||
'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces'
|
||||
)
|
||||
);
|
||||
afterEach(() =>
|
||||
esArchiver.unload(
|
||||
'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces'
|
||||
)
|
||||
);
|
||||
beforeEach(async () => await testDataLoader.beforeEach());
|
||||
afterEach(async () => await testDataLoader.afterEach());
|
||||
|
||||
const dashboardObject = { type: 'dashboard', id: `cts_dashboard_${spaceId}` };
|
||||
|
||||
|
@ -761,7 +766,7 @@ export function copyToSpaceTestSuiteFactory(
|
|||
|
||||
await assertSpaceCounts(destination, INITIAL_COUNTS[destination]);
|
||||
|
||||
return supertest
|
||||
return supertestWithoutAuth
|
||||
.post(`${getUrlPrefix(spaceId)}/api/spaces/_copy_saved_objects`)
|
||||
.auth(user.username, user.password)
|
||||
.send({
|
||||
|
@ -780,7 +785,7 @@ export function copyToSpaceTestSuiteFactory(
|
|||
|
||||
await assertSpaceCounts(destination, INITIAL_COUNTS[destination]);
|
||||
|
||||
return supertest
|
||||
return supertestWithoutAuth
|
||||
.post(`${getUrlPrefix(spaceId)}/api/spaces/_copy_saved_objects`)
|
||||
.auth(user.username, user.password)
|
||||
.send({
|
||||
|
@ -799,7 +804,7 @@ export function copyToSpaceTestSuiteFactory(
|
|||
|
||||
await assertSpaceCounts(destination, INITIAL_COUNTS[destination]);
|
||||
|
||||
return supertest
|
||||
return supertestWithoutAuth
|
||||
.post(`${getUrlPrefix(spaceId)}/api/spaces/_copy_saved_objects`)
|
||||
.auth(user.username, user.password)
|
||||
.send({
|
||||
|
@ -818,7 +823,7 @@ export function copyToSpaceTestSuiteFactory(
|
|||
|
||||
await assertSpaceCounts(destination, INITIAL_COUNTS[destination]);
|
||||
|
||||
return supertest
|
||||
return supertestWithoutAuth
|
||||
.post(`${getUrlPrefix(spaceId)}/api/spaces/_copy_saved_objects`)
|
||||
.auth(user.username, user.password)
|
||||
.send({
|
||||
|
@ -836,7 +841,7 @@ export function copyToSpaceTestSuiteFactory(
|
|||
const conflictDestination = getDestinationWithConflicts(spaceId);
|
||||
const noConflictDestination = getDestinationWithoutConflicts();
|
||||
|
||||
return supertest
|
||||
return supertestWithoutAuth
|
||||
.post(`${getUrlPrefix(spaceId)}/api/spaces/_copy_saved_objects`)
|
||||
.auth(user.username, user.password)
|
||||
.send({
|
||||
|
@ -869,7 +874,7 @@ export function copyToSpaceTestSuiteFactory(
|
|||
});
|
||||
|
||||
it(`should return ${tests.nonExistentSpace.statusCode} when copying to non-existent space`, async () => {
|
||||
return supertest
|
||||
return supertestWithoutAuth
|
||||
.post(`${getUrlPrefix(spaceId)}/api/spaces/_copy_saved_objects`)
|
||||
.auth(user.username, user.password)
|
||||
.send({
|
||||
|
@ -893,21 +898,13 @@ export function copyToSpaceTestSuiteFactory(
|
|||
const spaces = ['space_2'];
|
||||
const includeReferences = false;
|
||||
describe(`multi-namespace types with overwrite=${overwrite} and createNewCopies=${createNewCopies}`, () => {
|
||||
before(() =>
|
||||
esArchiver.load(
|
||||
'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces'
|
||||
)
|
||||
);
|
||||
after(() =>
|
||||
esArchiver.unload(
|
||||
'x-pack/test/spaces_api_integration/common/fixtures/es_archiver/saved_objects/spaces'
|
||||
)
|
||||
);
|
||||
before(async () => await testDataLoader.beforeEach());
|
||||
after(async () => await testDataLoader.afterEach());
|
||||
|
||||
const testCases = tests.multiNamespaceTestCases(overwrite, createNewCopies);
|
||||
testCases.forEach(({ testTitle, objects, statusCode, response }) => {
|
||||
it(`should return ${statusCode} when ${testTitle}`, async () => {
|
||||
return supertest
|
||||
return supertestWithoutAuth
|
||||
.post(`${getUrlPrefix(spaceId)}/api/spaces/_copy_saved_objects`)
|
||||
.auth(user.username, user.password)
|
||||
.send({ objects, spaces, includeReferences, createNewCopies, overwrite })
|
||||
|
|
|
@ -11,11 +11,7 @@ import { copyToSpaceTestSuiteFactory } from '../../common/suites/copy_to_space';
|
|||
import { FtrProviderContext } from '../../common/ftr_provider_context';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function copyToSpaceSpacesAndSecuritySuite({ getService }: FtrProviderContext) {
|
||||
const supertestWithoutAuth = getService('supertestWithoutAuth');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const es = getService('es');
|
||||
|
||||
export default function copyToSpaceSpacesAndSecuritySuite(context: FtrProviderContext) {
|
||||
const {
|
||||
copyToSpaceTest,
|
||||
expectNoConflictsWithoutReferencesResult,
|
||||
|
@ -27,10 +23,9 @@ export default function copyToSpaceSpacesAndSecuritySuite({ getService }: FtrPro
|
|||
createExpectUnauthorizedAtSpaceWithoutReferencesResult,
|
||||
expectRouteForbiddenResponse,
|
||||
createMultiNamespaceTestCases,
|
||||
} = copyToSpaceTestSuiteFactory(es, esArchiver, supertestWithoutAuth);
|
||||
} = copyToSpaceTestSuiteFactory(context);
|
||||
|
||||
// Failing: See https://github.com/elastic/kibana/issues/86544
|
||||
describe.skip('copy to spaces', () => {
|
||||
describe('copy to spaces', () => {
|
||||
[
|
||||
{
|
||||
spaceId: SPACES.DEFAULT.spaceId,
|
||||
|
|
|
@ -5,15 +5,11 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrProviderContext } from '../../../api_integration/ftr_provider_context';
|
||||
import { FtrProviderContext } from '../../common/ftr_provider_context';
|
||||
import { copyToSpaceTestSuiteFactory } from '../../common/suites/copy_to_space';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default function copyToSpacesOnlySuite({ getService }: FtrProviderContext) {
|
||||
const supertestWithoutAuth = getService('supertestWithoutAuth');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const es = getService('es');
|
||||
|
||||
export default function copyToSpacesOnlySuite(context: FtrProviderContext) {
|
||||
const {
|
||||
copyToSpaceTest,
|
||||
expectNoConflictsWithoutReferencesResult,
|
||||
|
@ -23,7 +19,7 @@ export default function copyToSpacesOnlySuite({ getService }: FtrProviderContext
|
|||
createExpectWithConflictsWithoutOverwritingResult,
|
||||
createMultiNamespaceTestCases,
|
||||
originSpaces,
|
||||
} = copyToSpaceTestSuiteFactory(es, esArchiver, supertestWithoutAuth);
|
||||
} = copyToSpaceTestSuiteFactory(context);
|
||||
|
||||
describe('copy to spaces', () => {
|
||||
originSpaces.forEach((spaceId) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue