Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ad0459b

Browse filesBrowse files
authored
Merge pull request #3392 from shiftstack/less_random_fewer_errors
acceptance: Prevent 409 when bulk-creating secgroup rules
2 parents dbed7c1 + 0cc4e3f commit ad0459b
Copy full SHA for ad0459b

File tree

Expand file treeCollapse file tree

1 file changed

+5
-7
lines changed
Filter options
  • internal/acceptance/openstack/networking/v2/extensions
Expand file treeCollapse file tree

1 file changed

+5
-7
lines changed

‎internal/acceptance/openstack/networking/v2/extensions/extensions.go

Copy file name to clipboardExpand all lines: internal/acceptance/openstack/networking/v2/extensions/extensions.go
+5-7Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,20 +140,18 @@ func CreateSecurityGroupRule(t *testing.T, client *gophercloud.ServiceClient, se
140140
return rule, nil
141141
}
142142

143-
// CreateSecurityGroupRulesBulk will create security group rules with a random name
144-
// and random port between 80 and 99.
143+
// CreateSecurityGroupRulesBulk will create 3 security group rules with ports between 1080 and 1099.
145144
// An error will be returned if one was failed to be created.
146145
func CreateSecurityGroupRulesBulk(t *testing.T, client *gophercloud.ServiceClient, secGroupID string) ([]rules.SecGroupRule, error) {
147146
t.Logf("Attempting to bulk create security group rules in group: %s", secGroupID)
148147

149148
sgRulesCreateOpts := make([]rules.CreateOpts, 3)
150-
for i := range 3 {
151-
description := "Rule description"
152-
fromPort := tools.RandomInt(1080, 1089)
153-
toPort := tools.RandomInt(1090, 1099)
149+
for i := range sgRulesCreateOpts {
150+
fromPort := 1080 + i
151+
toPort := tools.RandomInt(fromPort, 1099)
154152

155153
sgRulesCreateOpts[i] = rules.CreateOpts{
156-
Description: description,
154+
Description: "Rule description",
157155
Direction: "ingress",
158156
EtherType: "IPv4",
159157
SecGroupID: secGroupID,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.