mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-18 13:57:38 +00:00
test(validation): add cases HardwareAddress length in ResourceClaim status
This commit is contained in:
@@ -1161,6 +1161,39 @@ func testValidateStatusUpdateForDeclarative(t *testing.T, apiVersion string) {
|
||||
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "interfaceName"), "", resource.NetworkDeviceDataInterfaceNameMaxLength).MarkCoveredByDeclarative().WithOrigin("maxLength"),
|
||||
},
|
||||
},
|
||||
"valid status.devices.networkData.hardwareAddress": {
|
||||
old: mkValidResourceClaim(),
|
||||
update: mkResourceClaimWithStatus(
|
||||
tweakStatusDevices(
|
||||
resource.AllocatedDeviceStatus{
|
||||
Driver: "dra.example.com",
|
||||
Pool: "pool-0",
|
||||
Device: "device-0",
|
||||
NetworkData: &resource.NetworkDeviceData{
|
||||
HardwareAddress: strings.Repeat("a", resource.NetworkDeviceDataHardwareAddressMaxLength),
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
},
|
||||
"invalid status.devices.networkData.hardwareAddress too long": {
|
||||
old: mkValidResourceClaim(),
|
||||
update: mkResourceClaimWithStatus(
|
||||
tweakStatusDevices(
|
||||
resource.AllocatedDeviceStatus{
|
||||
Driver: "dra.example.com",
|
||||
Pool: "pool-0",
|
||||
Device: "device-0",
|
||||
NetworkData: &resource.NetworkDeviceData{
|
||||
HardwareAddress: strings.Repeat("a", resource.NetworkDeviceDataHardwareAddressMaxLength+1),
|
||||
},
|
||||
},
|
||||
),
|
||||
),
|
||||
expectedErrs: field.ErrorList{
|
||||
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "hardwareAddress"), "", resource.NetworkDeviceDataHardwareAddressMaxLength).MarkCoveredByDeclarative().WithOrigin("maxLength"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for k, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user