DRA integration: split into different packages

This does not change how tests are written registered, only which package
executes which tests.

Here's a comparison after cleaning compile and test caches. Wall-clock time is
actually lower with different packages because different packages can be tested
in parallel. The same tests run as before.

Before:

    PASS test/integration/dra.TestDRA/GA-opt-out/PrioritizedList (0.02s)
    PASS test/integration/dra.TestDRA/GA-opt-out (3.37s)
    PASS test/integration/dra.TestDRA/v1beta1/PublishResourceSlices/create (17.05s)
    PASS test/integration/dra.TestDRA/v1beta1/PublishResourceSlices (17.06s)
    PASS test/integration/dra.TestDRA/v1beta1 (1.63s)
    PASS test/integration/dra.TestDRA/v1beta2/PublishResourceSlices/create (17.05s)
    PASS test/integration/dra.TestDRA/v1beta2/PublishResourceSlices (17.05s)
    PASS test/integration/dra.TestDRA/v1beta2 (2.69s)
    PASS test/integration/dra.TestDRA/all/ControllerManagerMetrics (0.89s)
    PASS test/integration/dra.TestDRA/all/DeviceBindingConditions/TimeoutReached (6.36s)
    PASS test/integration/dra.TestDRA/all/DeviceBindingConditions/TimeoutRecover (7.35s)
    PASS test/integration/dra.TestDRA/all/DeviceBindingConditions/FailureRemove (7.20s)
    PASS test/integration/dra.TestDRA/all/DeviceBindingConditions/FailureTaints (7.20s)
    PASS test/integration/dra.TestDRA/all/DeviceBindingConditions/BasicFlow (12.23s)
    PASS test/integration/dra.TestDRA/all/DeviceBindingConditions (13.71s)
    PASS test/integration/dra.TestDRA/all/PartitionableDevices/PerDeviceNodeSelection (0.30s)
    PASS test/integration/dra.TestDRA/all/PartitionableDevices/MultiHostDevice (0.31s)
    PASS test/integration/dra.TestDRA/all/PartitionableDevices (0.61s)
    PASS test/integration/dra.TestDRA/all/MaxResourceSlice/basic (0.05s)
    PASS test/integration/dra.TestDRA/all/MaxResourceSlice/with-taints-and-consumes-counters (0.07s)
    PASS test/integration/dra.TestDRA/all/MaxResourceSlice/with-shared-counters (0.01s)
    PASS test/integration/dra.TestDRA/all/MaxResourceSlice (0.12s)
    PASS test/integration/dra.TestDRA/all/EvictClusterWithV1alpha3Rule (35.26s)
    PASS test/integration/dra.TestDRA/all/EvictClusterWithV1beta2Rule (35.36s)
    PASS test/integration/dra.TestDRA/all/EvictClusterWithSlices (4.11s)
    PASS test/integration/dra.TestDRA/all/InvalidResourceSlices/only-invalid-for-one-node (1.06s)
    PASS test/integration/dra.TestDRA/all/InvalidResourceSlices/invalid-for-all-nodes (1.13s)
    PASS test/integration/dra.TestDRA/all/InvalidResourceSlices/invalid-one-node-and-valid-other (1.05s)
    PASS test/integration/dra.TestDRA/all/InvalidResourceSlices (3.36s)
    PASS test/integration/dra.TestDRA/all/FilterTimeout/disabled (2.15s)
    PASS test/integration/dra.TestDRA/all/FilterTimeout/enabled (4.17s)
    PASS test/integration/dra.TestDRA/all/FilterTimeout (6.37s)
    PASS test/integration/dra.TestDRA/all/ShareResourceClaimSequentially (140.87s)
    PASS test/integration/dra.TestDRA/all/AdminAccess (0.01s)
    PASS test/integration/dra.TestDRA/all/Convert (0.01s)
    PASS test/integration/dra.TestDRA/all/ResourceClaimDeviceStatus (0.02s)
    PASS test/integration/dra.TestDRA/all/PrioritizedListScoring/single-claim (1.03s)
    PASS test/integration/dra.TestDRA/all/PrioritizedList (1.24s)
    PASS test/integration/dra.TestDRA/all/ImplicitExtendedResource (1.24s)
    PASS test/integration/dra.TestDRA/all/ExplicitExtendedResource (1.24s)
    PASS test/integration/dra.TestDRA/all/PrioritizedListScoring/multi-claim (1.00s)
    PASS test/integration/dra.TestDRA/all/PrioritizedListScoring (2.26s)
    PASS test/integration/dra.TestDRA/all/UsesAllResources (2.91s)
    PASS test/integration/dra.TestDRA/all/PublishResourceSlices/create (17.04s)
    PASS test/integration/dra.TestDRA/all/PublishResourceSlices/recreate-after-delete (26.09s)
    PASS test/integration/dra.TestDRA/all/PublishResourceSlices/fix-after-update (7.04s)
    PASS test/integration/dra.TestDRA/all/PublishResourceSlices (50.17s)
    PASS test/integration/dra.TestDRA/all (255.62s)
    PASS test/integration/dra.TestDRA/disabled/APIDisabled (0.00s)
    PASS test/integration/dra.TestDRA/disabled/Pod (0.00s)
    PASS test/integration/dra.TestDRA/disabled (2.71s)
    PASS test/integration/dra.TestDRA/default/EvictClusterWithSlices (3.93s)
    PASS test/integration/dra.TestDRA/default/FilterTimeout/disabled (2.14s)
    PASS test/integration/dra.TestDRA/default/FilterTimeout/enabled (4.17s)
    PASS test/integration/dra.TestDRA/default/FilterTimeout (6.33s)
    PASS test/integration/dra.TestDRA/default/Pod (0.01s)
    PASS test/integration/dra.TestDRA/default/UsesAllResources (3.96s)
    PASS test/integration/dra.TestDRA/default (12.90s)
    PASS test/integration/dra.TestDRA/GA/PartitionableDevices (0.00s)
    PASS test/integration/dra.TestDRA/GA/DeviceBindingConditions/BasicFlow (0.00s)
    PASS test/integration/dra.TestDRA/GA/DeviceBindingConditions (0.00s)
    PASS test/integration/dra.TestDRA/GA/ResourceSliceController (44.67s)
    PASS test/integration/dra.TestDRA/GA/ShareResourceClaimSequentially (130.58s)
    PASS test/integration/dra.TestDRA/GA/AdminAccess (0.00s)
    PASS test/integration/dra.TestDRA/GA/Pod (0.00s)
    PASS test/integration/dra.TestDRA/GA/ResourceClaimDeviceStatus (0.00s)
    PASS test/integration/dra.TestDRA/GA/PrioritizedList (1.21s)
    PASS test/integration/dra.TestDRA/GA/ImplicitExtendedResource (1.21s)
    PASS test/integration/dra.TestDRA/GA/ExplicitExtendedResource (1.21s)
    PASS test/integration/dra.TestDRA/GA/UsesAllResources (2.96s)
    PASS test/integration/dra.TestDRA/GA/PublishResourceSlices/create (17.04s)
    PASS test/integration/dra.TestDRA/GA/PublishResourceSlices/recreate-after-delete (26.08s)
    PASS test/integration/dra.TestDRA/GA/PublishResourceSlices/fix-after-update (7.04s)
    PASS test/integration/dra.TestDRA/GA/PublishResourceSlices (50.18s)
    PASS test/integration/dra.TestDRA/GA (177.94s)
    PASS test/integration/dra.TestDRA (595.30s)
    PASS test/integration/dra

    real	10m22.927s
    user	10m36.621s
    sys	1m20.993s

After:

    PASS test/integration/dra/api.TestDRA/disabled/APIDisabled (0.00s)
    PASS test/integration/dra/api.TestDRA/disabled/Pod (0.00s)
    PASS test/integration/dra/ga.TestDRA/GA/PartitionableDevices (0.01s)
    PASS test/integration/dra/ga.TestDRA/GA/DeviceBindingConditions/BasicFlow (0.01s)
    PASS test/integration/dra/ga.TestDRA/GA/DeviceBindingConditions (0.00s)
    PASS test/integration/dra/api.TestDRA/disabled (2.75s)
    PASS test/integration/dra/all.TestDRA/all/ControllerManagerMetrics (0.73s)
    PASS test/integration/dra/api.TestDRA/GA-opt-out/PrioritizedList (0.00s)
    PASS test/integration/dra/api.TestDRA/GA-opt-out (2.61s)
    PASS test/integration/dra/default.TestDRA/default/EvictClusterWithSlices (3.72s)
    PASS test/integration/dra/default.TestDRA/default/FilterTimeout/disabled (2.14s)
    PASS test/integration/dra/all.TestDRA/all/DeviceBindingConditions/TimeoutReached (6.30s)
    PASS test/integration/dra/default.TestDRA/default/FilterTimeout/enabled (4.16s)
    PASS test/integration/dra/default.TestDRA/default/FilterTimeout (6.32s)
    PASS test/integration/dra/default.TestDRA/default/Pod (0.01s)
    PASS test/integration/dra/all.TestDRA/all/DeviceBindingConditions/TimeoutRecover (6.40s)
    PASS test/integration/dra/default.TestDRA/default/UsesAllResources (4.19s)
    PASS test/integration/dra/default.TestDRA/default (13.41s)
    PASS test/integration/dra/default.TestDRA (17.61s)
    PASS test/integration/dra/default
    PASS test/integration/dra/all.TestDRA/all/DeviceBindingConditions/FailureRemove (7.21s)
    PASS test/integration/dra/api.TestDRA/v1beta1/PublishResourceSlices/create (17.05s)
    PASS test/integration/dra/api.TestDRA/v1beta1/PublishResourceSlices (17.05s)
    PASS test/integration/dra/api.TestDRA/v1beta1 (2.68s)
    PASS test/integration/dra/all.TestDRA/all/DeviceBindingConditions/FailureTaints (7.21s)
    PASS test/integration/dra/all.TestDRA/all/DeviceBindingConditions/BasicFlow (12.84s)
    PASS test/integration/dra/all.TestDRA/all/DeviceBindingConditions (12.70s)
    PASS test/integration/dra/all.TestDRA/all/PartitionableDevices/PerDeviceNodeSelection (0.37s)
    PASS test/integration/dra/all.TestDRA/all/PartitionableDevices/MultiHostDevice (0.31s)
    PASS test/integration/dra/all.TestDRA/all/PartitionableDevices (0.68s)
    PASS test/integration/dra/all.TestDRA/all/MaxResourceSlice/basic (0.04s)
    PASS test/integration/dra/all.TestDRA/all/MaxResourceSlice/with-taints-and-consumes-counters (0.07s)
    PASS test/integration/dra/all.TestDRA/all/MaxResourceSlice/with-shared-counters (0.00s)
    PASS test/integration/dra/all.TestDRA/all/MaxResourceSlice (0.12s)
    PASS test/integration/dra/api.TestDRA/v1beta2/PublishResourceSlices/create (17.05s)
    PASS test/integration/dra/api.TestDRA/v1beta2/PublishResourceSlices (17.05s)
    PASS test/integration/dra/api.TestDRA/v1beta2 (2.70s)
    PASS test/integration/dra/api.TestDRA (44.85s)
    PASS test/integration/dra/ga.TestDRA/GA/ResourceSliceController (44.57s)
    PASS test/integration/dra/api
    PASS test/integration/dra/all.TestDRA/all/EvictClusterWithV1alpha3Rule (35.22s)
    PASS test/integration/dra/all.TestDRA/all/EvictClusterWithV1beta2Rule (35.20s)
    PASS test/integration/dra/all.TestDRA/all/EvictClusterWithSlices (3.97s)
    PASS test/integration/dra/all.TestDRA/all/InvalidResourceSlices/invalid-one-node-and-valid-other (1.08s)
    PASS test/integration/dra/all.TestDRA/all/InvalidResourceSlices/only-invalid-for-one-node (1.04s)
    PASS test/integration/dra/all.TestDRA/all/InvalidResourceSlices/invalid-for-all-nodes (1.09s)
    PASS test/integration/dra/all.TestDRA/all/InvalidResourceSlices (3.32s)
    PASS test/integration/dra/all.TestDRA/all/FilterTimeout/disabled (2.16s)
    PASS test/integration/dra/all.TestDRA/all/FilterTimeout/enabled (4.16s)
    PASS test/integration/dra/all.TestDRA/all/FilterTimeout (6.35s)
    PASS test/integration/dra/ga.TestDRA/GA/ShareResourceClaimSequentially (130.55s)
    PASS test/integration/dra/ga.TestDRA/GA/AdminAccess (0.00s)
    PASS test/integration/dra/ga.TestDRA/GA/Pod (0.00s)
    PASS test/integration/dra/ga.TestDRA/GA/ResourceClaimDeviceStatus (0.00s)
    PASS test/integration/dra/ga.TestDRA/GA/PrioritizedList (1.21s)
    PASS test/integration/dra/ga.TestDRA/GA/ImplicitExtendedResource (1.21s)
    PASS test/integration/dra/ga.TestDRA/GA/ExplicitExtendedResource (1.21s)
    PASS test/integration/dra/ga.TestDRA/GA/UsesAllResources (2.85s)
    PASS test/integration/dra/ga.TestDRA/GA/PublishResourceSlices/create (17.04s)
    PASS test/integration/dra/ga.TestDRA/GA/PublishResourceSlices/recreate-after-delete (26.08s)
    PASS test/integration/dra/ga.TestDRA/GA/PublishResourceSlices/fix-after-update (7.04s)
    PASS test/integration/dra/ga.TestDRA/GA/PublishResourceSlices (50.16s)
    PASS test/integration/dra/ga.TestDRA/GA (178.21s)
    PASS test/integration/dra/ga.TestDRA (228.37s)
    PASS test/integration/dra/ga
    PASS test/integration/dra/all.TestDRA/all/ShareResourceClaimSequentially (150.80s)
    PASS test/integration/dra/all.TestDRA/all/AdminAccess (0.00s)
    PASS test/integration/dra/all.TestDRA/all/Convert (0.00s)
    PASS test/integration/dra/all.TestDRA/all/ResourceClaimDeviceStatus (0.01s)
    PASS test/integration/dra/all.TestDRA/all/ImplicitExtendedResource (1.21s)
    PASS test/integration/dra/all.TestDRA/all/ExplicitExtendedResource (1.21s)
    PASS test/integration/dra/all.TestDRA/all/PrioritizedListScoring/single-claim (1.10s)
    PASS test/integration/dra/all.TestDRA/all/PrioritizedList (1.31s)
    PASS test/integration/dra/all.TestDRA/all/PrioritizedListScoring/multi-claim (1.01s)
    PASS test/integration/dra/all.TestDRA/all/PrioritizedListScoring (2.34s)
    PASS test/integration/dra/all.TestDRA/all/UsesAllResources (2.70s)
    PASS test/integration/dra/all.TestDRA/all/PublishResourceSlices/create (17.04s)
    PASS test/integration/dra/all.TestDRA/all/PublishResourceSlices/recreate-after-delete (26.08s)
    PASS test/integration/dra/all.TestDRA/all/PublishResourceSlices/fix-after-update (7.05s)
    PASS test/integration/dra/all.TestDRA/all/PublishResourceSlices (50.17s)
    PASS test/integration/dra/all.TestDRA/all (265.28s)
    PASS test/integration/dra/all.TestDRA (315.46s)
    PASS test/integration/dra/all

    real	5m44.256s
    user	10m44.523s
    sys	1m20.929s
This commit is contained in:
Patrick Ohly
2026-03-11 14:27:31 +01:00
parent 93c8014f34
commit 180434e6b4
15 changed files with 204 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package all
import (
"testing"
"k8s.io/kubernetes/test/integration/dra"
)
func TestDRA(t *testing.T) {
dra.Run(t, "^all$")
}

View File

@@ -1,5 +1,5 @@
/*
Copyright 2025 The Kubernetes Authors.
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package dra
package all
import (
"testing"

View File

@@ -0,0 +1,28 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package api
import (
"testing"
"k8s.io/kubernetes/test/integration/dra"
)
func TestDRA(t *testing.T) {
// Various special configurations with few tests.
dra.Run(t, "^(disabled|v1beta1|v1beta2|slice-taints|GA-opt-out)$")
}

View File

@@ -0,0 +1,27 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package api
import (
"testing"
"k8s.io/kubernetes/test/integration/framework"
)
func TestMain(m *testing.M) {
framework.EtcdMain(m.Run)
}

View File

@@ -0,0 +1,27 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package def
import (
"testing"
"k8s.io/kubernetes/test/integration/dra"
)
func TestDRA(t *testing.T) {
dra.Run(t, "^default$")
}

View File

@@ -0,0 +1,27 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package def
import (
"testing"
"k8s.io/kubernetes/test/integration/framework"
)
func TestMain(m *testing.M) {
framework.EtcdMain(m.Run)
}

View File

@@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"math/rand/v2"
"regexp"
"sort"
"strings"
"sync"
@@ -116,8 +117,13 @@ const (
schedulingTimeout = time.Minute
)
func TestDRA(t *testing.T) { testDRA(ktesting.Init(t)) }
func testDRA(tCtx ktesting.TContext) {
func Run(t *testing.T, whatRE string) { run(ktesting.Init(t), whatRE) }
func run(tCtx ktesting.TContext, whatRE string) {
re, err := regexp.Compile(whatRE)
if err != nil {
tCtx.Fatalf("%s: %v", whatRE, err)
}
// Each sub-test brings up the API server in a certain
// configuration. These sub-tests must run sequentially because they
// change the global DefaultFeatureGate. For each configuration,
@@ -265,6 +271,10 @@ func testDRA(tCtx ktesting.TContext) {
},
},
} {
if !re.MatchString(name) {
continue
}
tCtx.Run(name, func(tCtx ktesting.TContext) {
var entries []string
for key, value := range tc.features {

View File

@@ -0,0 +1,27 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ga
import (
"testing"
"k8s.io/kubernetes/test/integration/dra"
)
func TestDRA(t *testing.T) {
dra.Run(t, "^GA$")
}

View File

@@ -0,0 +1,27 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ga
import (
"testing"
"k8s.io/kubernetes/test/integration/framework"
)
func TestMain(m *testing.M) {
framework.EtcdMain(m.Run)
}