mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
Add unit test for metadata modification
This commit is contained in:
parent
7ba79c3183
commit
a73f793e8e
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user