mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
Merge pull request #47408 from shiywang/follow-go-code-style
Automatic merge from submit-queue (batch tested with PRs 47416, 47408, 49697, 49860, 50162) follow our go code style: error->err Fixes https://github.com/kubernetes/kubernetes/issues/50189 ```release-note NONE ```
This commit is contained in:
commit
fa5877de18
@ -194,8 +194,8 @@ func TestGetImageUser(t *testing.T) {
|
|||||||
i.Images[test.originalImage.name].Username = test.originalImage.username
|
i.Images[test.originalImage.name].Username = test.originalImage.username
|
||||||
i.Images[test.originalImage.name].Uid = test.originalImage.uid
|
i.Images[test.originalImage.name].Uid = test.originalImage.uid
|
||||||
|
|
||||||
uid, username, error := m.getImageUser(test.originalImage.name)
|
uid, username, err := m.getImageUser(test.originalImage.name)
|
||||||
assert.NoError(t, error, "TestCase[%d]", j)
|
assert.NoError(t, err, "TestCase[%d]", j)
|
||||||
|
|
||||||
if test.expectedImageUserValues.uid == (*int64)(nil) {
|
if test.expectedImageUserValues.uid == (*int64)(nil) {
|
||||||
assert.Equal(t, test.expectedImageUserValues.uid, uid, "TestCase[%d]", j)
|
assert.Equal(t, test.expectedImageUserValues.uid, uid, "TestCase[%d]", j)
|
||||||
|
@ -24,8 +24,8 @@ func TestSchedulerConfiguratorFailure(t *testing.T) {
|
|||||||
sc := &schedulerConfigurator{
|
sc := &schedulerConfigurator{
|
||||||
// policyfile and algorithm are intentionally undefined.
|
// policyfile and algorithm are intentionally undefined.
|
||||||
}
|
}
|
||||||
_, error := sc.Create()
|
_, err := sc.Create()
|
||||||
if error == nil {
|
if err == nil {
|
||||||
t.Fatalf("Expected error message when creating with incomplete configurator.")
|
t.Fatalf("Expected error message when creating with incomplete configurator.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ func makeNode(node string, milliCPU, memory int64) *v1.Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestHumanReadableFitError(t *testing.T) {
|
func TestHumanReadableFitError(t *testing.T) {
|
||||||
error := &FitError{
|
err := &FitError{
|
||||||
Pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "2"}},
|
Pod: &v1.Pod{ObjectMeta: metav1.ObjectMeta{Name: "2"}},
|
||||||
FailedPredicates: FailedPredicateMap{
|
FailedPredicates: FailedPredicateMap{
|
||||||
"1": []algorithm.PredicateFailureReason{algorithmpredicates.ErrNodeUnderMemoryPressure},
|
"1": []algorithm.PredicateFailureReason{algorithmpredicates.ErrNodeUnderMemoryPressure},
|
||||||
@ -410,12 +410,12 @@ func TestHumanReadableFitError(t *testing.T) {
|
|||||||
"3": []algorithm.PredicateFailureReason{algorithmpredicates.ErrNodeUnderDiskPressure},
|
"3": []algorithm.PredicateFailureReason{algorithmpredicates.ErrNodeUnderDiskPressure},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if strings.Contains(error.Error(), NoNodeAvailableMsg) {
|
if strings.Contains(err.Error(), NoNodeAvailableMsg) {
|
||||||
if strings.Contains(error.Error(), "NodeUnderDiskPressure (2)") && strings.Contains(error.Error(), "NodeUnderMemoryPressure (1)") {
|
if strings.Contains(err.Error(), "NodeUnderDiskPressure (2)") && strings.Contains(err.Error(), "NodeUnderMemoryPressure (1)") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
t.Errorf("Error message doesn't have all the information content: [" + error.Error() + "]")
|
t.Errorf("Error message doesn't have all the information content: [" + err.Error() + "]")
|
||||||
}
|
}
|
||||||
|
|
||||||
// The point of this test is to show that you:
|
// The point of this test is to show that you:
|
||||||
|
Loading…
Reference in New Issue
Block a user