-
Notifications
You must be signed in to change notification settings - Fork 177
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
checks related fixes #787
checks related fixes #787
Conversation
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.
LGTM aside from the capitalization stuff
test/systemtests/bgp_test.go
Outdated
@@ -932,7 +932,7 @@ func (s *systemtestSuite) CheckBgpConnectionForaNode(c *C, node remotessh.Testbe | |||
return nil | |||
} | |||
} | |||
return errors.New("BGP connection not established") | |||
return errors.New("bGP connection not established") |
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.
This should be all lowercase
test/systemtests/bgp_test.go
Outdated
@@ -947,7 +947,7 @@ func (s *systemtestSuite) CheckBgpNoConnectionForaNode(c *C, node remotessh.Test | |||
return nil | |||
} | |||
} | |||
return errors.New("BGP connection persists") | |||
return errors.New("bGP connection persists") |
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.
Same here
test/systemtests/docker_test.go
Outdated
@@ -740,15 +740,15 @@ func (d *docker) verifyVTEPs(expVTEPS map[string]bool) (string, error) { | |||
for vtep := range expVTEPS { | |||
_, found := actVTEPs[vtep] | |||
if !found { | |||
return str, errors.New("VTEP " + vtep + " not found") | |||
return str, errors.New("vTEP " + vtep + " not found") |
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.
Same here
test/systemtests/k8setup_test.go
Outdated
@@ -731,15 +731,15 @@ func (k *kubernetes) verifyVTEPs(expVTEPS map[string]bool) (string, error) { | |||
for vtep := range expVTEPS { | |||
_, found := actVTEPs[vtep] | |||
if !found { | |||
return str, errors.New("VTEP " + vtep + " not found") | |||
return str, errors.New("vTEP " + vtep + " not found") |
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.
Same here
test/systemtests/swarm_test.go
Outdated
@@ -698,7 +698,7 @@ func (w *swarm) verifyVTEPs(expVTEPS map[string]bool) (string, error) { | |||
for vtep := range expVTEPS { | |||
_, found := actVTEPs[vtep] | |||
if !found { | |||
return str, errors.New("VTEP " + vtep + " not found") | |||
return str, errors.New("vTEP " + vtep + " not found") |
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.
Same here
@dseevr: I've made the changes. PTAL |
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.
It looks like this PR changes the capitalization of the first letter of a whole bunch of messages from upper case to lower case. It is unclear what value this adds. Can we not do this? It is likely to cause confusion/inconsistency as we print these errors in many paces, in a variety of formats.
drivers/ovsSwitch.go
Outdated
@@ -95,7 +95,7 @@ func NewOvsSwitch(bridgeName, netType, localIP string, fwdMode string, | |||
datapath = "vrouter" | |||
default: | |||
log.Errorf("Invalid datapath mode") | |||
return nil, errors.New("Invalid forwarding mode. Expects 'bridge' or 'routing'") | |||
return nil, errors.New("invalid forwarding mode. Expects 'bridge' or 'routing'") |
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 do not see the point of this change. The original string looks better to me.
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.
The point of this change is that error messages are meant to start with a lowercase letter and not have any punctuation at the end.
The goal of this convention is to be able to compose errors nicely. If you run into an error, you can do something like return fmt.Errorf("encountered error while opening file: %v", err)
; this error would be composable even further, e.g.: "failed to save data: encountered error while opening file: file doesn't exist".
There are some language conventions which should be followed. Others follow these conventions as well. I didn't come up with these conventions.
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.
This is also the convention that our errored repo follows
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.
https://github.com/pkg/errors is also using lowercase letters for the errors. The static analysis tools we use are used by other repositories as well. This is more of a convention, rather than a personal preference.
c437e95
to
8ff3c13
Compare
@unclejack could you take a quick look at getting this one passing, too? I think this would be worthwhile to get merged as a step towards cleaning up our tests |
31a3191
to
a418f42
Compare
This is running into some failures for some reason. I've got to look into this. |
This is only changing the error message format. I don't see how that is helping our tests. |
@gkvijay: This PR is also removing a blacklist which prevents any kind of code quality tool on the tests themselves. The changes I've made are the ones needed to make it possible to run those tools on the code base. Please feel free to try the other commit on a code checkout to see how I've had issues in the past where I had to craft PRs just to avoid gofmt related changes because the code wasn't properly formatted. We still have code in tests which isn't properly formatted. Obviously, this can never stop if we have the test directory in the blacklist. |
60bcd54
to
81e2f3b
Compare
@@ -122,7 +122,7 @@ func createEP(req *epSpec) (*epAttr, error) { | |||
netID := req.Network + "." + req.Tenant | |||
ep, err := netdGetEndpoint(netID + "-" + req.EndpointID) | |||
if err == nil { | |||
return nil, fmt.Errorf("EP %s already exists", req.EndpointID) | |||
return nil, fmt.Errorf("the EP %s already exists", req.EndpointID) | |||
} |
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.
can you change EP-> endpoint ?
netplugin/cluster/cluster.go
Outdated
@@ -230,7 +230,7 @@ func masterReq(path string, req interface{}, resp interface{}, isDel bool) error | |||
} | |||
|
|||
log.Errorf("Error making POST request. All master failed") | |||
return errors.New("POST request failed") | |||
return errors.New("the POST request failed") |
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.
In general if you are changing a string,
can you make it to more descriptive like "http POST request to master failed "
@unclejack can you fix the build failure ? |
@rchirakk: I've fixed the PR. The CI is running into some issues, but the issue is confirmed to be fixed. Perhaps this should be merged after 1.1. We can include it in 1.1.1. |
@@ -48,7 +48,7 @@ func nsToPID(ns string) (int, error) { | |||
// Make sure ns is well formed | |||
ok := strings.HasPrefix(ns, "/proc/") | |||
if !ok { | |||
return -1, fmt.Errorf("Invalid nw name space: %v", ns) | |||
return -1, fmt.Errorf("invalid network namespace: %v", ns) | |||
} |
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.
👍
@@ -330,7 +330,7 @@ func tcFilterCheckBw(expBw, expBurst int64) error { | |||
qdiscoutput := strings.Split(qdiscShow, "ingress") | |||
if len(qdiscoutput) < 2 { | |||
log.Errorf("Got `tc qdisco show` output:\n%s", qdiscShow) | |||
return fmt.Errorf("Unexpected `tc qdisco show` output") | |||
return fmt.Errorf("unexpected `tc qdisc show` output") | |||
} |
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.
no more disco 👍
func ErrIfKeyExists(err error) error { | ||
if err == nil || strings.Contains(err.Error(), "Key not found") { | ||
if err == nil || strings.Contains(err.Error(), "key not found") { | ||
return 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.
Just to cover all the cases,
better make it independent case, (use string.Tolower(err.Error()) before comparison)
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.
@rchirakk: This was just a quick fix for us to be able to use gofmt
, go vet
, golint
and the other tools on the entire code base. I intend to send some more PRs to refactor the error handling across the code base. I'd rather focus on starting the refactor work to avoid such issues in the future and make our code better.
LGTM other than the minor question/comment. |
Are there any other changes I should make for this? Please let me know. |
Is anyone still interested in this PR? |
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.
LGTM. Minor comments. Once CI is clean, it is OK to merge.
@@ -86,7 +86,7 @@ func (c *NWClient) AddPod(podInfo interface{}) (*cniapi.RspAddPod, error) { | |||
if err != nil { | |||
return nil, err | |||
} | |||
return &data, fmt.Errorf("Internal Server Error") | |||
return &data, fmt.Errorf("internal Server Error") |
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.
lower case all words?
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.
See the other comments in this PR discussion. This makes error messages composable
mgmtfn/k8splugin/driver.go
Outdated
@@ -122,7 +122,7 @@ func createEP(req *epSpec) (*epAttr, error) { | |||
netID := req.Network + "." + req.Tenant | |||
ep, err := netdGetEndpoint(netID + "-" + req.EndpointID) | |||
if err == nil { | |||
return nil, fmt.Errorf("EP %s already exists", req.EndpointID) | |||
return nil, fmt.Errorf("the endpoint %s already exists", req.EndpointID) |
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.
EP has a specific meaning in contiv, and can be left as in.
@unclejack please rebase and resubmit to get it merged in. |
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
b22e046
to
c12bcd6
Compare
I've fixed this, but the CI is failing. |
Is the k8s CI run expected to fail at this point? I remember there was some work in progress on it... |
@dseevr: It should work at this point. The failures are weird. |
ping @contiv/maintainers-core-networking. Please merge this PR. |
Is there something else I should do to get this PR merged? Does anyone have any questions or concerns related to this? I'd rather address any concerns now and not require another rebase and test cycle. |
Nothing further is needed. I will ping maintainers once more.
…-Himanshu
On Sep 21, 2017, at 5:44 AM, unclejack <notifications@github.com<mailto:notifications@github.com>> wrote:
Is there something else I should do to get this PR merged? Does anyone have any questions or concerns related to this? I'd rather address any concerns now and not require another rebase and test cycle.
-
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#787 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AMiMKduhNAKjk2T-kiKNxpFNPxsPfYCkks5skloQgaJpZM4Mfj3Y>.
|
This PR makes the following changes:
make checks
across the entire repository, except for vendorThis was an issue whenever code was being modified in the test directory. Some files would end up being formatted by
gofmt
. Thesegofmt
related changes would appear in commits. It's a good idea to follow these rules for the entire code base and not play ping-pong withgofmt
when making other changes.The fixes made to pass checks are the following:
gofmt
all the code