Merge pull request #71217 from jsafrane/status-update-unit-test

CSI v1 leftovers
This commit is contained in:
k8s-ci-robot 2018-11-29 15:26:53 -08:00 committed by GitHub
commit 81eb9ce491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 25 additions and 14 deletions

View File

@ -70,6 +70,8 @@ type StatusREST struct {
store *genericregistry.Store
}
var _ = rest.Patcher(&StatusREST{})
// New creates a new VolumeAttachment resource
func (r *StatusREST) New() runtime.Object {
return &storageapi.VolumeAttachment{}

View File

@ -113,9 +113,18 @@ func TestVolumeAttachmentStatusStrategy(t *testing.T) {
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.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)
if !apiequality.Semantic.DeepEqual(newVolumeAttachment, volumeAttachment) {