Skip to content

Commit

Permalink
fix integration tests
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Wang <[email protected]>
  • Loading branch information
wanglam committed Feb 27, 2024
1 parent 67dfa21 commit ee72f38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/plugins/workspace/server/permission_control/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SavedObjectsBulkGetObject,
SavedObjectsServiceStart,
Logger,
WORKSPACE_TYPE,
} from '../../../../core/server';
import { WORKSPACE_SAVED_OBJECTS_CLIENT_WRAPPER_ID } from '../../common/constants';
import { getPrincipalsFromRequest } from '../utils';
Expand All @@ -28,6 +29,7 @@ export class SavedObjectsPermissionControl {
private getScopedClient(request: OpenSearchDashboardsRequest) {
return this._getScopedClient?.(request, {
excludedWrappers: [WORKSPACE_SAVED_OBJECTS_CLIENT_WRAPPER_ID],
includedHiddenTypes: [WORKSPACE_TYPE],
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { ISavedObjectsRepository, SavedObjectsClientContract } from 'src/core/server';

import {
createTestServers,
TestOpenSearchUtils,
TestOpenSearchDashboardsUtils,
TestUtils,
} from '../../../../../core/test_helpers/osd_server';
import { SavedObjectsErrorHelpers } from '../../../../../core/server';
import {
SavedObjectsErrorHelpers,
WORKSPACE_TYPE,
ISavedObjectsRepository,
SavedObjectsClientContract,
} from '../../../../../core/server';
import { httpServerMock } from '../../../../../../src/core/server/mocks';
import * as utilsExports from '../../utils';

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

internalSavedObjectsRepository = osd.coreStart.savedObjects.createInternalRepository();
internalSavedObjectsRepository = osd.coreStart.savedObjects.createInternalRepository([
WORKSPACE_TYPE,
]);

await repositoryKit.create(
internalSavedObjectsRepository,
Expand Down Expand Up @@ -122,9 +127,12 @@ describe('WorkspaceSavedObjectsClientWrapper', () => {
return { users: ['foo'] };
});

permittedSavedObjectedClient = osd.coreStart.savedObjects.getScopedClient(permittedRequest);
permittedSavedObjectedClient = osd.coreStart.savedObjects.getScopedClient(permittedRequest, {
includedHiddenTypes: [WORKSPACE_TYPE],
});
notPermittedSavedObjectedClient = osd.coreStart.savedObjects.getScopedClient(
notPermittedRequest
notPermittedRequest,
{ includedHiddenTypes: [WORKSPACE_TYPE] }
);
});

Expand Down

0 comments on commit ee72f38

Please sign in to comment.