Skip to content

Commit

Permalink
spaces_only ftr test updates
Browse files Browse the repository at this point in the history
  • Loading branch information
TinaHeiligers committed Apr 25, 2023
1 parent e7c0319 commit cbd4561
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ export interface SavedObjectsImportSuccess {
*/
overwrite?: boolean;
/**
* @TINA add consistent, relevant description
* Flag indicating if a saved object is managed by Kibana (default=false)
*
* This can be leveraged by applications to e.g. prevent edits to a managed
* saved object. Instead, users can be guided to create a copy first and
* make their edits to the copy.
*/
managed?: boolean;
}
Expand Down
43 changes: 39 additions & 4 deletions x-pack/test/spaces_api_integration/common/suites/copy_to_space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
icon: 'dashboardApp',
},
destinationId: dashboardDestinationId,
managed: false,
},
],
},
Expand Down Expand Up @@ -229,24 +230,28 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
title: `Copy to Space index pattern 1 from ${spaceId} space`,
},
destinationId: indexPatternDestinationId,
managed: false,
},
{
id: `cts_vis_1_${spaceId}`,
type: 'visualization',
meta: { icon: 'visualizeApp', title: `CTS vis 1 from ${spaceId} space` },
destinationId: vis1DestinationId,
managed: false,
},
{
id: `cts_vis_2_${spaceId}`,
type: 'visualization',
meta: { icon: 'visualizeApp', title: `CTS vis 2 from ${spaceId} space` },
destinationId: vis2DestinationId,
managed: false,
},
{
id: `cts_vis_3_${spaceId}`,
type: 'visualization',
meta: { icon: 'visualizeApp', title: `CTS vis 3 from ${spaceId} space` },
destinationId: vis3DestinationId,
managed: false,
},
{
id: `cts_dashboard_${spaceId}`,
Expand All @@ -256,6 +261,7 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
title: `This is the ${spaceId} test space CTS dashboard`,
},
destinationId: dashboardDestinationId,
managed: false,
},
],
},
Expand Down Expand Up @@ -357,25 +363,29 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
},
overwrite: true,
destinationId: `cts_ip_1_${destination}`, // this conflicted with another index pattern in the destination space because of a shared originId
managed: false,
},
{
id: `cts_vis_1_${spaceId}`,
type: 'visualization',
meta: { icon: 'visualizeApp', title: `CTS vis 1 from ${spaceId} space` },
destinationId: vis1DestinationId,
managed: false,
},
{
id: `cts_vis_2_${spaceId}`,
type: 'visualization',
meta: { icon: 'visualizeApp', title: `CTS vis 2 from ${spaceId} space` },
destinationId: vis2DestinationId,
managed: false,
},
{
id: `cts_vis_3_${spaceId}`,
type: 'visualization',
meta: { icon: 'visualizeApp', title: `CTS vis 3 from ${spaceId} space` },
overwrite: true,
destinationId: `cts_vis_3_${destination}`, // this conflicted with another visualization in the destination space because of a shared originId
managed: false,
},
{
id: `cts_dashboard_${spaceId}`,
Expand All @@ -386,6 +396,7 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
},
overwrite: true,
destinationId: `cts_dashboard_${destination}`, // this conflicted with another dashboard in the destination space because of a shared originId
managed: false,
},
],
},
Expand Down Expand Up @@ -419,12 +430,14 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
type: 'visualization',
meta: { icon: 'visualizeApp', title: `CTS vis 1 from ${spaceId} space` },
destinationId: vis1DestinationId,
managed: false,
},
{
id: `cts_vis_2_${spaceId}`,
type: 'visualization',
meta: { icon: 'visualizeApp', title: `CTS vis 2 from ${spaceId} space` },
destinationId: vis2DestinationId,
managed: false,
},
];
const expectedErrors = [
Expand Down Expand Up @@ -522,7 +535,8 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
const destinationId = successResults![0].destinationId;
expect(destinationId).to.match(UUID_PATTERN);
const meta = { title, icon: 'beaker' };
expect(successResults).to.eql([{ type, id: sourceId, meta, destinationId }]);
const managed = false; // default added By `create`
expect(successResults).to.eql([{ type, id: sourceId, meta, destinationId, managed }]);
expect(errors).to.be(undefined);
};

Expand Down Expand Up @@ -594,7 +608,14 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
expect(success).to.eql(true);
expect(successCount).to.eql(1);
expect(successResults).to.eql([
{ type, id: inexactMatchIdA, meta, overwrite: true, destinationId },
{
type,
id: inexactMatchIdA,
meta,
overwrite: true,
destinationId,
managed: false,
},
]);
expect(errors).to.be(undefined);
} else {
Expand Down Expand Up @@ -635,7 +656,14 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
expect(success).to.eql(true);
expect(successCount).to.eql(1);
expect(successResults).to.eql([
{ type, id: inexactMatchIdB, meta, overwrite: true, destinationId },
{
type,
id: inexactMatchIdB,
meta,
overwrite: true,
destinationId,
managed: false,
},
]);
expect(errors).to.be(undefined);
} else {
Expand Down Expand Up @@ -676,7 +704,14 @@ export function copyToSpaceTestSuiteFactory(context: FtrProviderContext) {
expect(success).to.eql(true);
expect(successCount).to.eql(1);
expect(successResults).to.eql([
{ type, id: inexactMatchIdC, meta, overwrite: true, destinationId },
{
type,
id: inexactMatchIdC,
meta,
overwrite: true,
destinationId,
managed: false,
},
]);
expect(errors).to.be(undefined);
} else {
Expand Down
3 changes: 3 additions & 0 deletions x-pack/test/spaces_api_integration/common/suites/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,21 @@ export function getTestSuiteFactory(esArchiver: any, supertest: SuperAgent<any>)
description: 'This is the default space',
_reserved: true,
disabledFeatures: [],
managed: false,
},
{
id: 'space_1',
name: 'Space 1',
description: 'This is the first test space',
disabledFeatures: [],
managed: false,
},
{
id: 'space_2',
name: 'Space 2',
description: 'This is the second test space',
disabledFeatures: [],
managed: false,
},
];
expect(resp.body).to.eql(allSpaces.find((space) => space.id === spaceId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function resolveCopyToSpaceConflictsSuite(context: FtrProviderContext) {
},
destinationId: `cts_ip_1_${destination}`, // this conflicted with another index pattern in the destination space because of a shared originId
overwrite: true,
managed: false,
},
{
id: `cts_vis_3_${sourceSpaceId}`,
Expand All @@ -118,6 +119,7 @@ export function resolveCopyToSpaceConflictsSuite(context: FtrProviderContext) {
},
destinationId: `cts_vis_3_${destination}`, // this conflicted with another visualization in the destination space because of a shared originId
overwrite: true,
managed: false,
},
],
},
Expand Down Expand Up @@ -147,6 +149,7 @@ export function resolveCopyToSpaceConflictsSuite(context: FtrProviderContext) {
},
destinationId: `cts_dashboard_${destinationSpaceId}`, // this conflicted with another dashboard in the destination space because of a shared originId
overwrite: true,
managed: false,
},
],
},
Expand Down Expand Up @@ -380,7 +383,14 @@ export function resolveCopyToSpaceConflictsSuite(context: FtrProviderContext) {
})();
const meta = { title, icon: 'beaker' };
expect(successResults).to.eql([
{ type, id, meta, overwrite: true, ...(destinationId && { destinationId }) },
{
type,
id,
meta,
overwrite: true,
...(destinationId && { destinationId }),
managed: false,
},
]);
};

Expand Down

0 comments on commit cbd4561

Please sign in to comment.