Merge lp:~gz/goose/novaservice_preserve_negative_ports into lp:goose
Proposed by
Martin Packman
Status: | Merged |
---|---|
Approved by: | Martin Packman |
Approved revision: | 85 |
Merged at revision: | 86 |
Proposed branch: | lp:~gz/goose/novaservice_preserve_negative_ports |
Merge into: | lp:goose |
Diff against target: |
59 lines (+34/-2) 2 files modified
testservices/novaservice/service.go (+2/-2) testservices/novaservice/service_test.go (+32/-0) |
To merge this branch: | bzr merge lp:~gz/goose/novaservice_preserve_negative_ports |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+159519@code.launchpad.net |
Commit message
Preserve negative ports on novaservice
Description of the change
Preserve negative ports on novaservice
Creating a security group rule with the value -1 for the ports has a special
meaning in some cases, the test service needs to preserve these values rather
than treating it as the ports not having been set.
To post a comment you must log in.
Reviewers: mp+159519_ code.launchpad. net,
Message:
Please take a look.
Description:
Preserve negative ports on novaservice
Creating a security group rule with the value -1 for the ports has a
special
meaning in some cases, the test service needs to preserve these values
rather
than treating it as the ports not having been set.
https:/ /code.launchpad .net/~gz/ goose/novaservi ce_preserve_ negative_ ports/+ merge/159519
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/8796045/
Affected files: novaservice/ service. go novaservice/ service_ test.go
A [revision details]
M testservices/
M testservices/
Index: [revision details] 20130328125516- y1zpoibtfvl873g g
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: testservices/ novaservice/ service. go novaservice/ service. go' novaservice/ service. go 2013-02-25 07:16:32 +0000 novaservice/ service. go 2013-04-17 22:27:24 +0000 FromPort = &rule.FromPort
=== modified file 'testservices/
--- testservices/
+++ testservices/
@@ -458,10 +458,10 @@
Name: sourceGroup.Name,
}
}
- if rule.FromPort > 0 {
+ if rule.FromPort != 0 {
newrule.
}
- if rule.ToPort > 0 {
+ if rule.ToPort != 0 {
newrule.ToPort = &rule.ToPort
}
if rule.IPProtocol != "" {
Index: testservices/ novaservice/ service_ test.go novaservice/ service_ test.go' novaservice/ service_ test.go 2013-02-08 17:21:44 +0000 novaservice/ service_ test.go 2013-04-17 22:27:24 +0000
=== modified file 'testservices/
--- testservices/
+++ testservices/
@@ -789,6 +789,38 @@
c.Assert(*gr, DeepEquals, group)
}
+func (s *NovaSuite) TestAddSecurity GroupRuleKeepsN egativePort( c *C) { oupRule{ string{ "cidr": "0.0.0.0/0"}, addSecurityGrou pRule(rule. Id, ri) securityGroup( group.Id) returnedGroup. Rules, DeepEquals, []nova. SecurityGroupRu le{rule} ) ityGroupRuleTwi ceFails( c *C) { oup{Id: 1}
+ group := nova.SecurityGroup{
+ Id: 1,
+ Name: "test",
+ TenantId: s.service.TenantId,
+ }
+ s.createGroup(c, group)
+ defer s.deleteGroup(c, group)
+ ri := nova.RuleInfo{
+ IPProtocol: "icmp",
+ FromPort: -1,
+ ToPort: -1,
+ Cidr: "0.0.0.0/0",
+ ParentGroupId: group.Id,
+ }
+ rule := nova.SecurityGr
+ Id: 10,
+ ParentGroupId: group.Id,
+ FromPort: &ri.FromPort,
+ ToPort: &ri.ToPort,
+ IPProtocol: &ri.IPProtocol,
+ IPRange: map[string]
+ }
+ s.ensureNoRule(c, rule)
+ err := s.service.
+ c.Assert(err, IsNil)
+ defer s.deleteRule(c, rule)
+ returnedGroup, err := s.service.
+ c.Assert(err, IsNil)
+ c.Assert(
+}
+
func (s *NovaSuite) TestRemoveSecur
group := nova.SecurityGr
s.createGroup(c, group)