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 290ae22

Browse filesBrowse files
acceptance: Prevent 409 when bulk-creating secgroup rules
Reduce the randomness of port creation.
1 parent cf6f660 commit 290ae22
Copy full SHA for 290ae22

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+4
-5
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
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,16 @@ 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 {
149+
for i := range sgRulesCreateOpts {
151150
description := "Rule description"
152-
fromPort := tools.RandomInt(1080, 1089)
153-
toPort := tools.RandomInt(1090, 1099)
151+
fromPort := 1080 + i
152+
toPort := tools.RandomInt(fromPort, 1099)
154153

155154
sgRulesCreateOpts[i] = rules.CreateOpts{
156155
Description: description,

0 commit comments

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