Skip to content

Commit

Permalink
Merge pull request #7807 from zetaab/fixchanges
Browse files Browse the repository at this point in the history
Fix network changed in openstack ports
  • Loading branch information
k8s-ci-robot committed Oct 17, 2019
2 parents 2e646e2 + 9a87580 commit aa70e5f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion upup/pkg/fi/cloudup/openstacktasks/port.go
Expand Up @@ -144,7 +144,7 @@ func (_ *Port) CheckChanges(a, e, changes *Port) error {
if changes.Name != nil {
return fi.CannotChangeField("Name")
}
if e.Network != nil {
if changes.Network != nil {
return fi.CannotChangeField("Network")
}
}
Expand Down
18 changes: 17 additions & 1 deletion upup/pkg/fi/cloudup/openstacktasks/port_test.go
Expand Up @@ -389,10 +389,26 @@ func Test_Port_CheckChanges(t *testing.T) {
},
changes: &Port{
Name: nil,
Network: &Network{ID: fi.String("networkID")},
Network: nil,
},
expectedError: nil,
},
{
desc: "actual not nil all changeable fields set",
actual: &Port{
Name: fi.String("name"),
Network: nil,
},
expected: &Port{
Name: fi.String("name"),
Network: nil,
},
changes: &Port{
Name: nil,
Network: &Network{ID: fi.String("networkID")},
},
expectedError: fi.CannotChangeField("Network"),
},
{
desc: "actual not nil unchangeable field Name set",
actual: &Port{
Expand Down

0 comments on commit aa70e5f

Please sign in to comment.