Skip to content

Commit

Permalink
Merge pull request #1168 from sagikazarmark/resubmit-1064
Browse files Browse the repository at this point in the history
Resubmit #1064
  • Loading branch information
sagikazarmark committed Aug 19, 2021
2 parents 274c344 + 1c0d7c9 commit ab98ef0
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion auth/jwt/transport_test.go
Expand Up @@ -76,7 +76,7 @@ func TestGRPCToContext(t *testing.T) {
}

// Invalid Authorization header is passed
md["authorization"] = []string{fmt.Sprintf("%s", signedKey)}
md["authorization"] = []string{signedKey}
ctx = reqFunc(context.Background(), md)
token = ctx.Value(JWTContextKey)
if token != nil {
Expand Down
2 changes: 1 addition & 1 deletion metrics/generic/generic.go
Expand Up @@ -182,7 +182,7 @@ func (h *Histogram) LabelValues() []string {
func (h *Histogram) Print(w io.Writer) {
h.h.RLock()
defer h.h.RUnlock()
fmt.Fprintf(w, h.h.String())
fmt.Fprint(w, h.h.String())
}

// safeHistogram exists as gohistogram.Histogram is not goroutine-safe.
Expand Down
14 changes: 6 additions & 8 deletions sd/etcd/client_test.go
Expand Up @@ -129,14 +129,12 @@ type fakeWatcher struct {
// When an event occurs it just return nil response and error.
// When an error occur it return a non nil error.
func (fw *fakeWatcher) Next(context.Context) (*etcd.Response, error) {
for {
select {
case <-fw.event:
return nil, nil
case <-fw.err:
return nil, errors.New("error from underlying etcd watcher")
default:
}
select {
case <-fw.event:
return nil, nil
case <-fw.err:
return nil, errors.New("error from underlying etcd watcher")

}
}

Expand Down
2 changes: 1 addition & 1 deletion sd/zk/client_test.go
Expand Up @@ -63,7 +63,7 @@ func TestNewClient(t *testing.T) {
if want, have := sessionTimeout, clientImpl.sessionTimeout; want != have {
t.Errorf("want %d, have %d", want, have)
}
if want, have := payload, clientImpl.rootNodePayload; bytes.Compare(want[0], have[0]) != 0 || bytes.Compare(want[1], have[1]) != 0 {
if want, have := payload, clientImpl.rootNodePayload; !bytes.Equal(want[0], have[0]) || !bytes.Equal(want[1], have[1]) {
t.Errorf("want %s, have %s", want, have)
}

Expand Down
5 changes: 3 additions & 2 deletions transport/http/proto/proto_test.go
@@ -1,6 +1,7 @@
package proto

import (
"context"
"io/ioutil"
"net/http"
"net/http/httptest"
Expand All @@ -14,7 +15,7 @@ func TestEncodeProtoRequest(t *testing.T) {

r := httptest.NewRequest(http.MethodGet, "/cat", nil)

err := EncodeProtoRequest(nil, r, cat)
err := EncodeProtoRequest(context.TODO(), r, cat)
if err != nil {
t.Errorf("expected no encoding errors but got: %s", err)
return
Expand Down Expand Up @@ -51,7 +52,7 @@ func TestEncodeProtoResponse(t *testing.T) {

wr := httptest.NewRecorder()

err := EncodeProtoResponse(nil, wr, cat)
err := EncodeProtoResponse(context.TODO(), wr, cat)
if err != nil {
t.Errorf("expected no encoding errors but got: %s", err)
return
Expand Down

0 comments on commit ab98ef0

Please sign in to comment.