mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
kubectl: simplify deepcopy calls
This commit is contained in:
@@ -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{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user