revise err logic or null pointer exception (#2376)

pull/2327/head
jesse.tang 2 years ago committed by GitHub
parent f2a33929d0
commit 0ed01efdfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      config/reader_test.go
  2. 6
      contrib/config/polaris/config_test.go
  3. 2
      transport/transport_test.go

@ -132,9 +132,6 @@ a:
t.Fatal(`vvv is not equal to 1`)
}
if err != nil {
t.Fatal(`err is not nil`)
}
vv, ok = r.Value("a.b.Y")
if !ok {
t.Fatal(`ok is false`)
@ -147,9 +144,6 @@ a:
t.Fatal(`vvy is not equal to "lol"`)
}
if err != nil {
t.Fatal(`err is not nil`)
}
vv, ok = r.Value("a.b.z")
if !ok {
t.Fatal(`ok is false`)

@ -26,13 +26,13 @@ var (
func makeJSONRequest(uri string, data string, method string, headers map[string]string) ([]byte, error) {
client := http.Client{}
req, err := http.NewRequest(method, uri, strings.NewReader(data))
if err != nil {
return nil, err
}
req.Header.Add("Content-Type", "application/json")
for k, v := range headers {
req.Header.Add(k, v)
}
if err != nil {
return nil, err
}
res, err := client.Do(req)
if err != nil {
return nil, err

@ -53,7 +53,7 @@ func TestServerTransport(t *testing.T) {
t.Errorf("expected:%v got:%v", true, ok)
}
if mtr == nil {
t.Errorf("expected:%v got:%v", nil, mtr)
t.Fatalf("expected:%v got:%v", nil, mtr)
}
if mtr.Kind().String() != KindGRPC.String() {
t.Errorf("expected:%v got:%v", KindGRPC.String(), mtr.Kind().String())

Loading…
Cancel
Save