Skip to content

Commit c7e7de8

Browse files
committed
<fix>[test]: fix SG test cases: relax priority consecutive constraints to match new validation
Resolves: ZSTAC-79067 Change-Id: I6f134853bf7e16834a3d38df34334ebafd589167
1 parent 931d8d9 commit c7e7de8

2 files changed

Lines changed: 17 additions & 24 deletions

File tree

test/src/test/groovy/org/zstack/test/integration/networkservice/provider/flat/securitygroup/AddSecurityGroupRuleOptimizedCase.groovy

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ class AddSecurityGroupRuleOptimizedCase extends SubCase {
540540
addSecurityGroupRule {
541541
securityGroupUuid = sg3.uuid
542542
rules = [rule_82]
543-
priority = 82
543+
priority = 101
544544
}
545545
}
546546
}
@@ -591,13 +591,12 @@ class AddSecurityGroupRuleOptimizedCase extends SubCase {
591591
rule_13.protocol = "ALL"
592592
rule_13.startPort = -1
593593
rule_13.endPort = -1
594-
expect(AssertionError) {
595-
addSecurityGroupRule {
596-
securityGroupUuid = sg3.uuid
597-
rules = [rule_13]
598-
priority = 13
599-
}
594+
sg3 = addSecurityGroupRule {
595+
securityGroupUuid = sg3.uuid
596+
rules = [rule_13]
597+
priority = 13
600598
}
599+
assert sg3.rules.find { it.allowedCidr == rule_13.allowedCidr && it.priority == 13 } != null
601600

602601
SecurityGroupRuleAO rule_12 = new SecurityGroupRuleAO()
603602
rule_12.dstIpRange = "2.2.2.2-2.2.2.10"
@@ -609,12 +608,10 @@ class AddSecurityGroupRuleOptimizedCase extends SubCase {
609608
ingressRule.protocol = "TCP"
610609
ingressRule.dstPortRange = "12-13"
611610

612-
expect(AssertionError) {
613-
addSecurityGroupRule {
614-
securityGroupUuid = sg3.uuid
615-
rules = [rule_12, ingressRule]
616-
priority = 12
617-
}
611+
sg3 = addSecurityGroupRule {
612+
securityGroupUuid = sg3.uuid
613+
rules = [rule_12, ingressRule]
614+
priority = 12
618615
}
619616

620617
}

test/src/test/groovy/org/zstack/test/integration/networkservice/provider/flat/securitygroup/ChangeSecurityGroupRuleCase.groovy

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,15 @@ class ChangeSecurityGroupRuleCase extends SubCase {
231231
assert sg3 != null
232232
SecurityGroupRuleInventory rule_1 = sg3.rules.find { it.type == "Ingress" && it.priority == 1 && it.ipVersion == 4 }
233233

234-
expect(AssertionError) {
235-
changeSecurityGroupRule {
236-
uuid = rule_1.uuid
237-
priority = 6
238-
}
234+
changeSecurityGroupRule {
235+
uuid = rule_1.uuid
236+
priority = 6
239237
}
240238

241239
expect(AssertionError) {
242240
changeSecurityGroupRule {
243241
uuid = rule_1.uuid
244-
priority = 7
242+
priority = 101
245243
}
246244
}
247245
}
@@ -307,11 +305,9 @@ class ChangeSecurityGroupRuleCase extends SubCase {
307305
}
308306
}
309307

310-
expect(AssertionError) {
311-
changeSecurityGroupRule {
312-
uuid = rule1.uuid
313-
priority = 3
314-
}
308+
changeSecurityGroupRule {
309+
uuid = rule1.uuid
310+
priority = 3
315311
}
316312

317313
expect(AssertionError) {

0 commit comments

Comments
 (0)