kubectl: simplify deepcopy calls

This commit is contained in:
Dr. Stefan Schimanski
2017-08-15 14:13:20 +02:00
parent 1d633b7fdd
commit c0dbe9a900
9 changed files with 40 additions and 39 deletions

View File

@@ -130,8 +130,7 @@ func TestPatchNoop(t *testing.T) {
// Patched
{
copied, _ := api.Scheme.DeepCopy(patchObject)
patchObject = copied.(*api.Service)
patchObject = patchObject.DeepCopy()
if patchObject.Annotations == nil {
patchObject.Annotations = map[string]string{}
}
@@ -150,11 +149,7 @@ func TestPatchNoop(t *testing.T) {
func TestPatchObjectFromFileOutput(t *testing.T) {
_, svc, _ := testData()
svcCopyObj, err := api.Scheme.DeepCopy(&svc.Items[0])
if err != nil {
t.Fatal(err)
}
svcCopy := svcCopyObj.(*api.Service)
svcCopy := svc.Items[0].DeepCopy()
if svcCopy.Labels == nil {
svcCopy.Labels = map[string]string{}
}