From ca66143d5fc5645eeffd83d64de4d1a519b2ba4a Mon Sep 17 00:00:00 2001 From: yongruilin Date: Wed, 18 Mar 2026 22:26:41 +0000 Subject: [PATCH] Add DRA test for device attribute with no value set Test that declarative validation catches a DeviceAttribute with no value fields set, which was the original bug scenario where union ratcheting incorrectly skipped validation for new map entries. --- .../resource/resourceslice/declarative_validation_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/registry/resource/resourceslice/declarative_validation_test.go b/pkg/registry/resource/resourceslice/declarative_validation_test.go index 4264de1aa9a..35a1bff8e2e 100644 --- a/pkg/registry/resource/resourceslice/declarative_validation_test.go +++ b/pkg/registry/resource/resourceslice/declarative_validation_test.go @@ -304,6 +304,13 @@ func TestDeclarativeValidateUpdate(t *testing.T) { field.Invalid(field.NewPath("spec", "devices").Index(0).Child("attributes").Key("test.io/multiple"), "", "").WithOrigin("union").MarkAlpha(), }, }, + "invalid update: device attribute no value": { + old: mkResourceSliceWithDevices(), + update: mkResourceSliceWithDevices(tweakDeviceAttribute("test.io/empty", resource.DeviceAttribute{})), + expectedErrs: field.ErrorList{ + field.Invalid(field.NewPath("spec", "devices").Index(0).Child("attributes").Key("test.io/empty"), "", "").WithOrigin("union").MarkAlpha(), + }, + }, // spec.sharedCounters "valid update: at limit shared counters": { old: mkResourceSliceWithSharedCounters(),