mirror of https://github.com/k3s-io/k3s
Merge pull request #51543 from sttts/sttts-deepcopy-admission
Automatic merge from submit-queue (batch tested with PRs 51228, 50185, 50940, 51544, 51543) admission plugins: simplify deepcopy callspull/6/head
commit
5030391c07
|
@ -729,12 +729,8 @@ func TestExclusionNoAdmit(t *testing.T) {
|
|||
},
|
||||
},
|
||||
}
|
||||
originalPod, err := api.Scheme.Copy(pod)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = admitPod(pod, pip)
|
||||
originalPod := pod.DeepCopy()
|
||||
err := admitPod(pod, pip)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -797,12 +793,8 @@ func TestAdmitEmptyPodNamespace(t *testing.T) {
|
|||
},
|
||||
},
|
||||
}
|
||||
originalPod, err := api.Scheme.Copy(pod)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
err = admitPod(pod, pip)
|
||||
originalPod := pod.DeepCopy()
|
||||
err := admitPod(pod, pip)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -320,11 +320,7 @@ func (e *quotaEvaluator) checkQuotas(quotas []api.ResourceQuota, admissionAttrib
|
|||
func copyQuotas(in []api.ResourceQuota) ([]api.ResourceQuota, error) {
|
||||
out := make([]api.ResourceQuota, 0, len(in))
|
||||
for _, quota := range in {
|
||||
copied, err := api.Scheme.Copy("a)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
out = append(out, *copied.(*api.ResourceQuota))
|
||||
out = append(out, *quota.DeepCopy())
|
||||
}
|
||||
|
||||
return out, nil
|
||||
|
|
|
@ -191,11 +191,7 @@ func TestAdmission(t *testing.T) {
|
|||
glog.V(4).Infof("starting test %q", test.name)
|
||||
|
||||
// clone the claim, it's going to be modified
|
||||
clone, err := api.Scheme.DeepCopy(test.claim)
|
||||
if err != nil {
|
||||
t.Fatalf("Cannot clone claim: %v", err)
|
||||
}
|
||||
claim := clone.(*api.PersistentVolumeClaim)
|
||||
claim := test.claim.DeepCopy()
|
||||
|
||||
ctrl := newPlugin()
|
||||
informerFactory := informers.NewSharedInformerFactory(nil, controller.NoResyncPeriodFunc())
|
||||
|
@ -214,7 +210,7 @@ func TestAdmission(t *testing.T) {
|
|||
admission.Create,
|
||||
nil, // userInfo
|
||||
)
|
||||
err = ctrl.Admit(attrs)
|
||||
err := ctrl.Admit(attrs)
|
||||
glog.Infof("Got %v", err)
|
||||
if err != nil && !test.expectError {
|
||||
t.Errorf("Test %q: unexpected error received: %v", test.name, err)
|
||||
|
|
Loading…
Reference in New Issue