Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix existing failed integration test cases #260

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
TestOpenSearchDashboardsUtils,
TestUtils,
} from '../../../../../core/test_helpers/osd_server';
import { SavedObjectsErrorHelpers } from '../../../../../core/server';
import { SavedObjectsErrorHelpers, WORKSPACE_TYPE } from '../../../../../core/server';
import { httpServerMock } from '../../../../../../src/core/server/mocks';
import * as utilsExports from '../../utils';

Expand Down Expand Up @@ -74,7 +74,13 @@ describe('WorkspaceSavedObjectsClientWrapper', () => {
opensearchServer = await servers.startOpenSearch();
osd = await servers.startOpenSearchDashboards();

internalSavedObjectsRepository = osd.coreStart.savedObjects.createInternalRepository();
/**
* Workspace is a hidden type,
* and this integration_test is mainly to test the permission control function so we add workspace into includedHiddenTypes
*/
internalSavedObjectsRepository = osd.coreStart.savedObjects.createInternalRepository([
WORKSPACE_TYPE,
]);

await repositoryKit.create(
internalSavedObjectsRepository,
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/workspace/server/workspace_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ export class WorkspaceClientWithSavedObject implements IWorkspaceClientImpl {
type: WORKSPACE_TYPE,
...(permissionModes ? { ACLSearchParams: { permissionModes } } : {}),
});
const { saved_objects: resultSavedObjects, ...others } = resultResp;
const { saved_objects: resultSavedObjects, ...resultOthers } = resultResp;
let savedObjects = resultSavedObjects;
let others = resultOthers;
const scopedClientWithoutPermissionCheck = this.getScopedClientWithoutPermission(
requestDetail
);
Expand Down Expand Up @@ -397,7 +398,9 @@ export class WorkspaceClientWithSavedObject implements IWorkspaceClientImpl {
type: WORKSPACE_TYPE,
...(permissionModes ? { ACLSearchParams: { permissionModes } } : {}),
});
const { saved_objects: retrySavedObjects, ...retryOthers } = retryFindResp;
savedObjects = retryFindResp.saved_objects;
others = retryOthers;
}
} catch (e) {
this.logger.error(`Some error happened when initializing reserved workspace: ${e}`);
Expand Down
Loading