-
Notifications
You must be signed in to change notification settings - Fork 852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
patch resourcebinding instead of update and update observed generation. #2345
Conversation
…neration. Signed-off-by: yy158775 <1584616775@qq.com>
pkg/scheduler/scheduler_test.go
Outdated
t.Error(err) | ||
} | ||
if !reflect.DeepEqual(res, test.expected) { | ||
t.Errorf("Test %s Not Equal", test.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to log the test name as the name is already present in the result.
For example(I hacked the tests and let it fails) :
$ go test ./pkg/scheduler/... -run=Test_patchBindingScheduleStatus -v
=== RUN Test_patchBindingScheduleStatus
=== RUN Test_patchBindingScheduleStatus/add_success_condition
=== RUN Test_patchBindingScheduleStatus/add_failure_condition
=== RUN Test_patchBindingScheduleStatus/replace_to_success_condition
=== RUN Test_patchBindingScheduleStatus/replace_failure_condition
scheduler_test.go:171: Test replace failure condition Not Equal
The Test_patchBindingScheduleStatus/replace_failure_condition
is exactly the test name.
pkg/scheduler/scheduler_test.go
Outdated
if !reflect.DeepEqual(res, test.expected) { | ||
t.Errorf("Test %s Not Equal", test.name) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !reflect.DeepEqual(res, test.expected) { | |
t.Errorf("Test %s Not Equal", test.name) | |
} | |
if !reflect.DeepEqual(res.Status, test.expected.Status) { | |
t.Errorf("expected status: %v, but got: %v", test.expected.Status, res.Status) | |
} |
pkg/scheduler/scheduler_test.go
Outdated
t.Error(err) | ||
} | ||
if !reflect.DeepEqual(res.Status, test.expected.Status) { | ||
t.Errorf("Not Equal") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg/scheduler/scheduler_test.go
Outdated
t.Run(test.name, func(t *testing.T) { | ||
_, err := karmadaClient.WorkV1alpha2().ResourceBindings(test.binding.Namespace).Create(context.TODO(), test.binding, metav1.CreateOptions{}) | ||
if err != nil { | ||
t.Error(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should use Fatal
or Fatalf
here since if there is an error, we can skip following checks.
Signed-off-by: yy158775 <1584616775@qq.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: RainbowMango The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: