clientv3/integration: Don't retry other endpoints when err == rpctypes.ErrAuthNotEnable #10428
clientv3/integration: Don't retry other endpoints when err == rpctypes.ErrAuthNotEnable #10428xiang90 merged 1 commit intoetcd-io:masterfrom cfc4n:master
Conversation
Codecov Report
@@ Coverage Diff @@
## master #10428 +/- ##
==========================================
- Coverage 71.61% 71.56% -0.06%
==========================================
Files 392 392
Lines 36489 36491 +2
==========================================
- Hits 26131 26113 -18
- Misses 8531 8560 +29
+ Partials 1827 1818 -9
Continue to review full report at Codecov.
|
|
@cfc4n can you add a test? |
OK,please wait... |
|
@xiang90 Is my test code correct? |
| resp, err = auth.authenticate(ctx, c.Username, c.Password) | ||
| if err != nil { | ||
| if err == rpctypes.ErrAuthNotEnabled { | ||
| // return err if err == rpctypes.ErrAuthNotEnable ,Don't retry other endpoints |
There was a problem hiding this comment.
I would suggest to just say something like "// return err without retrying other endpoints" (to keep it clean as the if condition is self explanatory)
There was a problem hiding this comment.
No problem @cfc4n and thank you for addressing the suggestions!
| } | ||
|
|
||
|
|
||
| // fixes # https://github.com/etcd-io/etcd/issues/10430 |
| // fixes # https://github.com/etcd-io/etcd/issues/10430 | ||
| func ExampleGetTokenWithoutAuth() { | ||
| var tmpEndpoints = []string{} | ||
| fmt.Println("it will append 100 times into {tmpEndpoints} with {endpoints}.") |
There was a problem hiding this comment.
Also, I don't think this print statement is needed.
|
@mitake Done,I'll do it next time.thanks. |
|
Can you add the test as an integration test here: https://github.com/etcd-io/etcd/tree/master/clientv3/integration instead of an example? thanks! |
|
@cfc4n could you fix errors from fmt test and build errors reported in https://travis-ci.com/etcd-io/etcd/jobs/173656226 ? |
| } | ||
|
|
||
| client, err = clientv3.New(cfg) | ||
|
|
| case nil: | ||
| t.Log("passes as expected, but may be connection time less than DialTimeout") | ||
| case context.DeadlineExceeded: | ||
| t.Fatalf("not expected result:%v with endpoint:%s", err, authapi.Endpoints()) |
| case rpctypes.ErrAuthNotEnabled: | ||
| t.Logf("passes as expected:%v", err) | ||
| default: | ||
| t.Fatalf("other errors:%v", err) |
|
please squash commits into one with the right prefix "clientv3". thanks! |
|
Now you have 10 commits in one issue. You need to follow this: |
|
Got it ,thanks. |
|
hmm... there are now 12 commits in this PR. Can you try |
| default: | ||
| t.Errorf("other errors:%v", err) | ||
| } | ||
| defer client.Close() |
There was a problem hiding this comment.
well. if you still put client.Close() here, then no need to add defer. move this to line 138, right after the creation of the client instead.
|
@xiang90 Is it correct now? But I'm also not understand the report in https://travis-ci.com/etcd-io/etcd/jobs/174849460 ,why it's failed at Job 666.4\ Job 666.9\ Job 666.11 and, what can I do for this report? It seems nothing to do with my PR. |
|
the test failure has nothing to do with this RP. LGTM. Thanks for the contribution! |
|
cc @jpbetz |
Fixes #10430