mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
Merge pull request #71217 from jsafrane/status-update-unit-test
CSI v1 leftovers
This commit is contained in:
commit
81eb9ce491
@ -70,6 +70,8 @@ type StatusREST struct {
|
|||||||
store *genericregistry.Store
|
store *genericregistry.Store
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var _ = rest.Patcher(&StatusREST{})
|
||||||
|
|
||||||
// New creates a new VolumeAttachment resource
|
// New creates a new VolumeAttachment resource
|
||||||
func (r *StatusREST) New() runtime.Object {
|
func (r *StatusREST) New() runtime.Object {
|
||||||
return &storageapi.VolumeAttachment{}
|
return &storageapi.VolumeAttachment{}
|
||||||
|
@ -113,9 +113,18 @@ func TestVolumeAttachmentStatusStrategy(t *testing.T) {
|
|||||||
t.Errorf("unexpected objects differerence after modifying status: %v", diff.ObjectDiff(statusVolumeAttachment, expectedVolumeAttachment))
|
t.Errorf("unexpected objects differerence after modifying status: %v", diff.ObjectDiff(statusVolumeAttachment, expectedVolumeAttachment))
|
||||||
}
|
}
|
||||||
|
|
||||||
// modifying spec should be dropped
|
// spec and metadata modifications should be dropped
|
||||||
newVolumeAttachment := volumeAttachment.DeepCopy()
|
newVolumeAttachment := volumeAttachment.DeepCopy()
|
||||||
newVolumeAttachment.Spec.NodeName = "valid-node-2"
|
newVolumeAttachment.Spec.NodeName = "valid-node-2"
|
||||||
|
newVolumeAttachment.Labels = map[string]string{"foo": "bar"}
|
||||||
|
newVolumeAttachment.Annotations = map[string]string{"foo": "baz"}
|
||||||
|
newVolumeAttachment.OwnerReferences = []metav1.OwnerReference{
|
||||||
|
{
|
||||||
|
APIVersion: "v1",
|
||||||
|
Kind: "Pod",
|
||||||
|
Name: "Foo",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
StatusStrategy.PrepareForUpdate(ctx, newVolumeAttachment, volumeAttachment)
|
StatusStrategy.PrepareForUpdate(ctx, newVolumeAttachment, volumeAttachment)
|
||||||
if !apiequality.Semantic.DeepEqual(newVolumeAttachment, volumeAttachment) {
|
if !apiequality.Semantic.DeepEqual(newVolumeAttachment, volumeAttachment) {
|
||||||
|
Loading…
Reference in New Issue
Block a user