Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 16 for PrepareForUpdate (0.69 sec)

  1. pkg/registry/apps/statefulset/strategy_test.go

    			Status: apps.StatefulSetStatus{Replicas: 4},
    		}
    		Strategy.PrepareForUpdate(ctx, validPs, ps)
    		errs = Strategy.ValidateUpdate(ctx, validPs, ps)
    		if len(errs) != 0 {
    			t.Errorf("updating spec.Replicas and minReadySeconds is allowed on a statefulset: %v", errs)
    		}
    		invalidPs := ps
    		invalidPs.Spec.MinReadySeconds = int32(-1)
    		Strategy.PrepareForUpdate(ctx, validPs, invalidPs)
    		errs = Strategy.ValidateUpdate(ctx, validPs, ps)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 22.1K bytes
    - Viewed (0)
  2. pkg/registry/policy/poddisruptionbudget/strategy_test.go

    		},
    	}
    
    	// Nothing in Spec changes: OK
    	Strategy.PrepareForUpdate(ctx, newPdb, pdb)
    	errs = Strategy.ValidateUpdate(ctx, newPdb, pdb)
    	if len(errs) != 0 {
    		t.Errorf("Unexpected error updating PodDisruptionBudget.")
    	}
    
    	// Changing the selector?  OK
    	newPdb.Spec.Selector = &metav1.LabelSelector{MatchLabels: map[string]string{"a": "bar"}}
    	Strategy.PrepareForUpdate(ctx, newPdb, pdb)
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 19.2K bytes
    - Viewed (0)
  3. pkg/registry/batch/cronjob/strategy_test.go

    			Schedule: "5 5 5 * ?",
    		},
    		Status: batch.CronJobStatus{
    			LastScheduleTime: &now,
    		},
    	}
    
    	// ensure we do not change status
    	Strategy.PrepareForUpdate(ctx, updatedCronJob, cronJob)
    	if updatedCronJob.Status.Active != nil {
    		t.Errorf("PrepareForUpdate should have preserved prior version status")
    	}
    	if updatedCronJob.Generation != 2 {
    		t.Errorf("expected Generation=2, got %d", updatedCronJob.Generation)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 15 14:34:53 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  4. pkg/registry/core/service/strategy.go

    	service := obj.(*api.Service)
    	service.Status = api.ServiceStatus{}
    
    	dropServiceDisabledFields(service, nil)
    }
    
    // PrepareForUpdate sets contextual defaults and clears fields that are not allowed to be set by end users on update.
    func (svcStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.Object) {
    	newService := obj.(*api.Service)
    	oldService := old.(*api.Service)
    	newService.Status = oldService.Status
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Thu Apr 11 13:09:36 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  5. pkg/registry/storage/csinode/strategy_test.go

    	ctx := genericapirequest.WithRequestInfo(genericapirequest.NewContext(), &genericapirequest.RequestInfo{
    		APIGroup:   "storage.k8s.io",
    		APIVersion: "v1beta1",
    		Resource:   "csinodes",
    	})
    	Strategy.PrepareForUpdate(ctx, obj, old)
    	if !reflect.DeepEqual(*expected, *obj) {
    		t.Errorf("Object mismatch! Expected:\n%#v\ngot:\n%#v", *expected, *obj)
    	}
    }
    
    func TestCSINodeStrategy(t *testing.T) {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 15 09:24:44 UTC 2024
    - 8.7K bytes
    - Viewed (0)
  6. pkg/registry/storage/csidriver/strategy_test.go

    	}
    
    	// Update of spec is disallowed
    	newCSIDriver := csiDriver.DeepCopy()
    	attachNotRequired := false
    	newCSIDriver.Spec.AttachRequired = &attachNotRequired
    
    	Strategy.PrepareForUpdate(ctx, newCSIDriver, csiDriver)
    
    	errs = Strategy.ValidateUpdate(ctx, newCSIDriver, csiDriver)
    	if len(errs) == 0 {
    		t.Errorf("Expected a validation error")
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  7. pkg/registry/certificates/certificates/strategy_test.go

    					},
    				},
    			},
    		},
    	}
    
    	for _, tt := range tests {
    		t.Run(tt.name, func(t *testing.T) {
    			obj := tt.newObj.DeepCopy()
    			StatusStrategy.PrepareForUpdate(context.TODO(), obj, tt.oldObj.DeepCopy())
    			if !reflect.DeepEqual(obj, tt.expectedObj) {
    				t.Errorf("object diff: %s", cmp.Diff(obj, tt.expectedObj))
    			}
    		})
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Apr 15 14:34:53 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  8. staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/strategy_test.go

    				},
    			},
    		},
    	}
    	for _, tc := range tcs {
    		if tc.statusEnabled {
    			strategy.status = &apiextensions.CustomResourceSubresourceStatus{}
    		} else {
    			strategy.status = nil
    		}
    		strategy.PrepareForUpdate(context.TODO(), tc.obj, tc.old)
    		if !reflect.DeepEqual(tc.obj, tc.expected) {
    			t.Errorf("test %q failed: expected: %v, got %v", tc.name, tc.expected, tc.obj)
    		}
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 8.2K bytes
    - Viewed (0)
  9. pkg/registry/core/persistentvolume/strategy_test.go

    			featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.PersistentVolumeLastPhaseTransitionTime, tc.fg)
    
    			obj := tc.newObj.DeepCopy()
    			StatusStrategy.PrepareForUpdate(context.TODO(), obj, tc.oldObj.DeepCopy())
    			if !reflect.DeepEqual(obj, tc.expectedObj) {
    				t.Errorf("object diff: %s", cmp.Diff(obj, tc.expectedObj))
    			}
    		})
    	}
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 11K bytes
    - Viewed (0)
  10. pkg/registry/core/persistentvolumeclaim/strategy_test.go

    			newPvcHasConditions, newPvc := newPvcInfo.hasConditions, newPvcInfo.pvc()
    
    			t.Run(fmt.Sprintf("old pvc %s, new pvc %s", oldPvcInfo.description, newPvcInfo.description), func(t *testing.T) {
    				StatusStrategy.PrepareForUpdate(ctx, newPvc, oldPvc)
    
    				// old pvc should never be changed
    				if !reflect.DeepEqual(oldPvc, oldPvcInfo.pvc()) {
    					t.Errorf("old pvc changed: %v", cmp.Diff(oldPvc, oldPvcInfo.pvc()))
    				}
    
    				switch {
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Wed Apr 24 18:25:29 UTC 2024
    - 11.2K bytes
    - Viewed (0)
Back to top