Merge pull request #52951 from kargakis/remove-dead-code

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Simplify some deployment utilities

Sponsored by the recent refactoring that removed errors
from deep copies.

Signed-off-by: Michalis Kargakis <mkargaki@redhat.com>
This commit is contained in:
Kubernetes Submit Queue
2017-10-03 08:11:04 -07:00
committed by GitHub
4 changed files with 29 additions and 58 deletions

View File

@@ -396,11 +396,7 @@ func TestEqualIgnoreHash(t *testing.T) {
reverseString = " (reverse order)"
}
// Run
equal, err := EqualIgnoreHash(t1, t2)
if err != nil {
t.Errorf("%s: unexpected error: %v", err, test.Name)
return
}
equal := EqualIgnoreHash(t1, t2)
if equal != test.expected {
t.Errorf("%q%s: expected %v", test.Name, reverseString, test.expected)
return
@@ -463,8 +459,8 @@ func TestFindNewReplicaSet(t *testing.T) {
for _, test := range tests {
t.Run(test.Name, func(t *testing.T) {
if rs, err := FindNewReplicaSet(&test.deployment, test.rsList); !reflect.DeepEqual(rs, test.expected) || err != nil {
t.Errorf("In test case %q, expected %#v, got %#v: %v", test.Name, test.expected, rs, err)
if rs := FindNewReplicaSet(&test.deployment, test.rsList); !reflect.DeepEqual(rs, test.expected) {
t.Errorf("In test case %q, expected %#v, got %#v", test.Name, test.expected, rs)
}
})
}
@@ -531,15 +527,15 @@ func TestFindOldReplicaSets(t *testing.T) {
for _, test := range tests {
t.Run(test.Name, func(t *testing.T) {
requireRS, allRS, err := FindOldReplicaSets(&test.deployment, test.rsList)
requireRS, allRS := FindOldReplicaSets(&test.deployment, test.rsList)
sort.Sort(controller.ReplicaSetsByCreationTimestamp(allRS))
sort.Sort(controller.ReplicaSetsByCreationTimestamp(test.expected))
if !reflect.DeepEqual(allRS, test.expected) || err != nil {
t.Errorf("In test case %q, expected %#v, got %#v: %v", test.Name, test.expected, allRS, err)
if !reflect.DeepEqual(allRS, test.expected) {
t.Errorf("In test case %q, expected %#v, got %#v", test.Name, test.expected, allRS)
}
// RSs are getting filtered correctly by rs.spec.replicas
if !reflect.DeepEqual(requireRS, test.expectedRequire) || err != nil {
t.Errorf("In test case %q, expected %#v, got %#v: %v", test.Name, test.expectedRequire, requireRS, err)
if !reflect.DeepEqual(requireRS, test.expectedRequire) {
t.Errorf("In test case %q, expected %#v, got %#v", test.Name, test.expectedRequire, requireRS)
}
})
}