mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-17 11:28:58 +00:00
Merge pull request #137639 from pohly/dra-integration-extendedresource-alloc-fix
DRA integration: fix test isolation of extended resource test
This commit is contained in:
@@ -97,14 +97,17 @@ func createTestClassWithSpec(tCtx ktesting.TContext, namespace string, spec *res
|
||||
driverName := namespace + driverNameSuffix
|
||||
class := class.DeepCopy()
|
||||
class.Name = namespace + classNameSuffix
|
||||
class.Spec.Selectors = []resourceapi.DeviceSelector{{
|
||||
CEL: &resourceapi.CELDeviceSelector{
|
||||
Expression: fmt.Sprintf("device.driver == %q", driverName),
|
||||
},
|
||||
}}
|
||||
if spec != nil {
|
||||
class.Spec = *spec
|
||||
}
|
||||
// If the caller didn't supply a selector, we add the one which selects by driver name.
|
||||
if len(class.Spec.Selectors) == 0 {
|
||||
class.Spec.Selectors = []resourceapi.DeviceSelector{{
|
||||
CEL: &resourceapi.CELDeviceSelector{
|
||||
Expression: fmt.Sprintf("device.driver == %q", driverName),
|
||||
},
|
||||
}}
|
||||
}
|
||||
class, err := tCtx.Client().ResourceV1().DeviceClasses().Create(tCtx, class, metav1.CreateOptions{})
|
||||
tCtx.ExpectNoError(err, "create class")
|
||||
tCtx.CleanupCtx(func(tCtx ktesting.TContext) {
|
||||
|
||||
Reference in New Issue
Block a user