fix(test): fix TestGetPodResourcesV1 comparison logic in tests

This commit is contained in:
ithrael 2023-08-30 10:39:58 +08:00
parent 9a24dd2c27
commit e187368242

View File

@ -705,13 +705,18 @@ func TestGetPodResourcesV1(t *testing.T) {
server := NewV1PodResourcesServer(providers)
podReq := &podresourcesapi.GetPodResourcesRequest{PodName: podName, PodNamespace: podNamespace}
resp, err := server.Get(context.TODO(), podReq)
if err != nil {
if err.Error() != tc.err.Error() {
t.Errorf("want exit = %v, got %v", tc.err, err)
}
} else {
if !equalGetResponse(tc.expectedResponse, resp) {
t.Errorf("want resp = %s, got %s", tc.expectedResponse.String(), resp.String())
if err != tc.err {
t.Errorf("want exit = %v, got %v", tc.err, err)
} else {
if !equalGetResponse(tc.expectedResponse, resp) {
t.Errorf("want resp = %s, got %s", tc.expectedResponse.String(), resp.String())
}
}
}
})