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.
This commit is contained in:
yongruilin
2026-03-18 22:26:41 +00:00
parent 39e99b2a2c
commit ca66143d5f

View File

@@ -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(),