Skip to content

Commit

Permalink
Fix existing failed integration test cases (opensearch-project#260)
Browse files Browse the repository at this point in the history
* fix: integration test fail

Signed-off-by: SuZhou-Joe <[email protected]>

* feat: change variable name

Signed-off-by: SuZhou-Joe <[email protected]>

---------

Signed-off-by: SuZhou-Joe <[email protected]>
  • Loading branch information
SuZhou-Joe authored Feb 29, 2024
1 parent e025fd7 commit 587f0d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
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

0 comments on commit 587f0d4

Please sign in to comment.