Skip to content

Commit cea9e39

Browse files
committed
fixing unit tests to comply with bug "CLOUDSTACK-2477: [GSLB]
CloudStack currently allows admin to map LB rule of one account to GSLB rule of a different account"
1 parent ee31728 commit cea9e39

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

server/test/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImplTest.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,17 +577,29 @@ void runAssignToGlobalLoadBalancerRuleTestSameZoneLb() throws Exception {
577577
LoadBalancerVO lbRule1 = new LoadBalancerVO();
578578
lbRule1.setState(FirewallRule.State.Active);
579579
Field networkIdField1 = LoadBalancerVO.class.getSuperclass().getDeclaredField("networkId");
580+
Field accountIdField1 = LoadBalancerVO.class.getSuperclass().getDeclaredField("accountId");
581+
Field domainIdField1 = LoadBalancerVO.class.getSuperclass().getDeclaredField("domainId");
580582
networkIdField1.setAccessible(true);
583+
accountIdField1.setAccessible(true);
584+
domainIdField1.setAccessible(true);
581585
networkIdField1.set(lbRule1, new Long(1));
586+
accountIdField1.set(lbRule1, new Long(3));
587+
domainIdField1.set(lbRule1, new Long(1));
582588
Field idField1 = LoadBalancerVO.class.getSuperclass().getDeclaredField("id");
583589
idField1.setAccessible(true);
584590
idField1.set(lbRule1, new Long(1));
585591

586592
LoadBalancerVO lbRule2 = new LoadBalancerVO();
587593
lbRule2.setState(FirewallRule.State.Active);
588594
Field networkIdField2 = LoadBalancerVO.class.getSuperclass().getDeclaredField("networkId");
595+
Field accountIdField2 = LoadBalancerVO.class.getSuperclass().getDeclaredField("accountId");
596+
Field domainIdField2 = LoadBalancerVO.class.getSuperclass().getDeclaredField("domainId");
589597
networkIdField2.setAccessible(true);
598+
accountIdField2.setAccessible(true);
599+
domainIdField2.setAccessible(true);
590600
networkIdField2.set(lbRule2, new Long(1));
601+
accountIdField2.set(lbRule2, new Long(3));
602+
domainIdField2.set(lbRule2, new Long(1));
591603
Field idField2 = LoadBalancerVO.class.getSuperclass().getDeclaredField("id");
592604
idField2.setAccessible(true);
593605
idField2.set(lbRule2, new Long(2));
@@ -611,6 +623,7 @@ void runAssignToGlobalLoadBalancerRuleTestSameZoneLb() throws Exception {
611623
try {
612624
gslbServiceImpl.assignToGlobalLoadBalancerRule(assignCmd);
613625
} catch (InvalidParameterValueException e) {
626+
s_logger.info(e.getMessage());
614627
Assert.assertTrue(e.getMessage().contains("Load balancer rule specified should be in unique zone"));
615628
}
616629
}

0 commit comments

Comments
 (0)