Skip to content
Open
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 @@ -180,10 +180,10 @@ public String ownedByVirtualComputeGroup(String computeGroupName) {
if (computeGroupName.equals(vcg.getPolicy().getActiveComputeGroup())) {
return vcg.getName();
}
if (vcg.getPolicy().getStandbyComputeGroup().contains(computeGroupName)) {
if (vcg.getPolicy().getStandbyComputeGroup().equals(computeGroupName)) {
return vcg.getName();
}
if (vcg.getSubComputeGroups().contains(computeGroupName)) {
if (vcg.getSubComputeGroups().stream().anyMatch(subCgName -> subCgName.equals(computeGroupName))) {
return vcg.getName();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,11 @@ public void testVirtualComputeGroup() throws UserException {
Assert.fail();
}
// create vcg, sub cg(cg1, cg2), add to systemInfoService
ComputeGroup vcg = new ComputeGroup("vcg_id", virtualComputeGroup, ComputeGroup.ComputeTypeEnum.VIRTUAL);
vcg.setSubComputeGroups(Lists.newArrayList(computeGroup2, computeGroup1));
systemInfoService.addComputeGroup(virtualComputeGroup, vcg);
ComputeGroup vcg = new ComputeGroup("vcg_id", "vcg", ComputeGroup.ComputeTypeEnum.VIRTUAL);
vcg.setSubComputeGroups(Lists.newArrayList("cg2", "cg1"));
systemInfoService.addComputeGroup("vcg_id", vcg);
ComputeGroup cg = new ComputeGroup("vcg_id", "vcg", ComputeGroup.ComputeTypeEnum.COMPUTE);
systemInfoService.addComputeGroup("cg", cg);
ComputeGroup.Policy policy = new ComputeGroup.Policy();
policy.setActiveComputeGroup(computeGroup1);
policy.setStandbyComputeGroup(computeGroup2);
Expand All @@ -495,6 +497,8 @@ public void testVirtualComputeGroup() throws UserException {
PrivPredicate.USAGE, ResourceTypeEnum.CLUSTER));
Assert.assertTrue(accessManager.checkCloudPriv(userIdentity, computeGroup2,
PrivPredicate.USAGE, ResourceTypeEnum.CLUSTER));
Assert.assertFalse(accessManager.checkCloudPriv(new UserIdentity("testUser", "%"), "cg",
PrivPredicate.USAGE, ResourceTypeEnum.CLUSTER));
ShowResultSet showResultSet = testShowGrants(userIdentity);
// cluster field
Assert.assertEquals("vcg: Cluster_usage_priv", showResultSet.getResultRows().get(0).get(10));
Expand Down