Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
Signed-off-by: ryjiang <jiangruiyi@gmail.com>
  • Loading branch information
shanghaikid committed Dec 24, 2024
1 parent 6116a87 commit f2be254
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions test/grpc/User.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import exp from 'constants';
import {
MilvusClient,
ERROR_REASONS,
Expand All @@ -6,6 +7,7 @@ import {
Roles,
Privileges,
RbacObjects,
OperatePrivilegeGroupType,
} from '../../milvus';
import { timeoutTest } from '../tools';
import { IP, genCollectionParams, GENERATE_NAME } from '../tools';
Expand Down Expand Up @@ -291,10 +293,17 @@ describe(`User Api`, () => {
it(`add privileges to a privilege group`, async () => {
const res = await authClient.addPrivilegesToGroup({
group_name: PRIVILEGE_GRP_NAME,
privileges: [Privileges.Search, Privileges.Query],
privileges: [Privileges.Query],
});

expect(res.error_code).toEqual(ErrorCode.SUCCESS);

const res2 = await authClient.operatePrivilegeGroup({
group_name: PRIVILEGE_GRP_NAME,
privileges: [{ name: Privileges.Search }],
type: OperatePrivilegeGroupType.AddPrivilegesToGroup,
});
expect(res2.error_code).toEqual(ErrorCode.SUCCESS);
});

it(`remove privileges from a privilege group`, async () => {
Expand All @@ -312,7 +321,7 @@ describe(`User Api`, () => {
g => g.group_name === PRIVILEGE_GRP_NAME
)!;
expect(grp.group_name).toEqual(PRIVILEGE_GRP_NAME);
expect(grp.privileges.map(p => p.name)).toContain( Privileges.Search);
expect(grp.privileges.map(p => p.name)).toContain(Privileges.Search);
});

it(`drop a privilege group`, async () => {
Expand Down

0 comments on commit f2be254

Please sign in to comment.