-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ofnet_test.go: write some loops as functions #86
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Cristian Staretu <[email protected]>
This increases the readability of the code, so I am fine with it. What do you guys say? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look fine to me, just some minor pedantry
vxlanAgents[i] = agent | ||
case "vrtr": | ||
vrtrAgents[i] = agent | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd add a default case here which panics/logs a fatal error just to be pedantic
j := ovsDriversOffset + i | ||
ovsDrivers[j] = ovsdbDriver.NewOvsDriver(brName) | ||
err := ovsDrivers[j].AddController("127.0.0.1", ovsPort) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error check can be inline
brName := fmt.Sprintf("%vBridge%v", brPrefix, i) | ||
log.Infof("deleting OVS bridge: %s", brName) | ||
err := ovsDrivers[ovsDriversOffset+i].DeleteBridge(brName) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error check can be inline
This PR rewrites some loops as functions. This makes it easier to update this code in the future.
This PR doesn't fix any bugs. It can be reviewed and merged when there's time.