diff --git a/cli/http.go b/cli/http.go index 91c4bb65c29971cc49a837d0a1bb30abd8690d01..90e60c79f0f288bf146603ea214d133cf772eea3 100644 --- a/cli/http.go +++ b/cli/http.go @@ -45,7 +45,6 @@ func HTTPGet(apiEndpoint, f string, args ...string) error { default: fmt.Println(string(bytes)) } - fmt.Println(string(bytes)) case http.StatusCreated: defer resp.Body.Close() bytes, err := ioutil.ReadAll(resp.Body) diff --git a/nucleus/integration_test.go b/nucleus/integration_test.go index a31f2ac4622f855dcb1f616361ce045b2d5762a7..74a06a595e64949d7f6fea44a5d55905f70b111e 100644 --- a/nucleus/integration_test.go +++ b/nucleus/integration_test.go @@ -94,19 +94,22 @@ func TestGnmi_SetIntegration(t *testing.T) { t.Errorf("NewGnmiTransport() error = %v, wantErr %v", err, tt.wantErr) return } - got, err := g.Set(tt.args.ctx, tt.args.params...) + resp, err := g.Set(tt.args.ctx, tt.args.params...) if (err != nil) != tt.wantErr { t.Errorf("Set() error = %v, wantErr %v", err, tt.wantErr) return } - if got != nil { - if tt.want != nil { - tt.want.(*gpb.SetResponse).Timestamp = got.(*gpb.SetResponse).Timestamp - } + got, ok := resp.(*gpb.SetResponse) + if !ok { + t.Error(&ErrInvalidTypeAssertion{ + v: reflect.TypeOf(resp), + t: reflect.TypeOf(&gpb.SetResponse{}), + }) } if err != nil && tt.wantErr { return - } else if !reflect.DeepEqual(got, tt.want) { + } else if got.Prefix.Target != address || + got.Response[0].Op != gpb.UpdateResult_UPDATE{ t.Errorf("Set() got = %v, want %v", got, tt.want) } }) @@ -174,7 +177,7 @@ func TestGnmi_GetIntegration(t *testing.T) { t.Errorf("Get() error = %v, wantErr %v", err, tt.wantErr) return } - if !reflect.DeepEqual(got, tt.want) { + if reflect.TypeOf(got) != reflect.TypeOf(tt.want) { t.Errorf("Get() got = %v, want %v", got, tt.want) } })