From 356be5ae30f85219cbeeae159fee3f69951c0dac Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 14 Jul 2025 18:35:52 +0200 Subject: [PATCH] DRA E2E: move upgrade/downgrade test into test/e2e_dra It's similar to test/e2e_kubeadm in the sense that it is a test which must be excluded from both "make test" and "make integration" by default. --- hack/make-rules/test.sh | 1 + test/{integration/dra/cluster => e2e_dra}/README.md | 10 +++++----- .../dra/cluster => e2e_dra}/gtesting_test.go | 2 +- test/{integration/dra/cluster => e2e_dra}/run.sh | 0 .../dra/cluster => e2e_dra}/upgradedowngrade_test.go | 11 ++++++----- test/integration/dra/cluster/.import-restrictions | 5 ----- 6 files changed, 13 insertions(+), 16 deletions(-) rename test/{integration/dra/cluster => e2e_dra}/README.md (82%) rename test/{integration/dra/cluster => e2e_dra}/gtesting_test.go (99%) rename test/{integration/dra/cluster => e2e_dra}/run.sh (100%) rename test/{integration/dra/cluster => e2e_dra}/upgradedowngrade_test.go (98%) delete mode 100644 test/integration/dra/cluster/.import-restrictions diff --git a/hack/make-rules/test.sh b/hack/make-rules/test.sh index 9961f102b55..c683c2d1abb 100755 --- a/hack/make-rules/test.sh +++ b/hack/make-rules/test.sh @@ -50,6 +50,7 @@ kube::test::find_go_packages() { -e '^k8s.io/kubernetes/third_party(/.*)?$' \ -e '^k8s.io/kubernetes/cmd/kubeadm/test(/.*)?$' \ -e '^k8s.io/kubernetes/test/e2e$' \ + -e '^k8s.io/kubernetes/test/e2e_dra$' \ -e '^k8s.io/kubernetes/test/e2e_node(/.*)?$' \ -e '^k8s.io/kubernetes/test/e2e_kubeadm(/.*)?$' \ -e '^k8s.io/.*/test/integration(/.*)?$' diff --git a/test/integration/dra/cluster/README.md b/test/e2e_dra/README.md similarity index 82% rename from test/integration/dra/cluster/README.md rename to test/e2e_dra/README.md index 460c996936a..a3e8abbd446 100644 --- a/test/integration/dra/cluster/README.md +++ b/test/e2e_dra/README.md @@ -23,19 +23,19 @@ To run it: Otherwise a test tmp directory is used. - Invoke as a Go test (no need for the ginkgo CLI), for example: - go test -v -count=1 ./test/integration/dra/cluster -args -ginkgo.v - dlv test ./test/integration/dra/cluster -- -ginkgo.v - make test WHAT=test/integration/dra/cluster FULL_LOG=true KUBE_TEST_ARGS="-count=1 -args -ginkgo.v" + go test -v -count=1 -timeout=1h ./test/e2e_dra -args -ginkgo.v + dlv test ./test/e2e_dra -- -ginkgo.v + make test KUBE_TIMEOUT=-timeout=1h WHAT=test/e2e_dra FULL_LOG=true KUBE_TEST_ARGS="-count=1 -args -ginkgo.v" `make test` instead of `make test-integration` is intentional: `local-up-cluster.sh` itself wants to start etcd. `-count=1` ensures that test runs each time it is invoked. `-v` and `-ginkgo.v` make the test output visible while the test runs. -To simplify starting from scratch, ./test/integration/dra/cluster/run.sh cleans +To simplify starting from scratch, `./test/e2e_dra/run.sh` cleans up, sets permissions, and then invokes whatever command is specified on the command line: - ./test/integration/dra/cluster/run.sh go test ./test/integration/dra/cluster + ./test/e2e_dra/run.sh go test ./test/e2e_dra The test is implemented as a Ginkgo suite because that allows reusing the same helper code as in E2E tests. Long-term the goal is to port that helper code to diff --git a/test/integration/dra/cluster/gtesting_test.go b/test/e2e_dra/gtesting_test.go similarity index 99% rename from test/integration/dra/cluster/gtesting_test.go rename to test/e2e_dra/gtesting_test.go index c62216efaaa..db2c57c0ec5 100644 --- a/test/integration/dra/cluster/gtesting_test.go +++ b/test/e2e_dra/gtesting_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cluster +package e2edra import ( "context" diff --git a/test/integration/dra/cluster/run.sh b/test/e2e_dra/run.sh similarity index 100% rename from test/integration/dra/cluster/run.sh rename to test/e2e_dra/run.sh diff --git a/test/integration/dra/cluster/upgradedowngrade_test.go b/test/e2e_dra/upgradedowngrade_test.go similarity index 98% rename from test/integration/dra/cluster/upgradedowngrade_test.go rename to test/e2e_dra/upgradedowngrade_test.go index a4df376445c..f60342f2b0e 100644 --- a/test/integration/dra/cluster/upgradedowngrade_test.go +++ b/test/e2e_dra/upgradedowngrade_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cluster +package e2edra import ( "archive/tar" @@ -81,9 +81,6 @@ func repoRootDefault() string { } func TestUpgradeDowngrade(t *testing.T) { - if envName, dir := currentBinDir(); dir == "" { - t.Skipf("%s must be set to test DRA upgrade/downgrade scenarios.", envName) - } suiteConfig, reporterConfig := framework.CreateGinkgoConfig() ginkgo.RunSpecs(t, "DRA", suiteConfig, reporterConfig) } @@ -103,6 +100,11 @@ var _ = ginkgo.Describe("DRA upgrade/downgrade", func() { tCtx := ktesting.Init(GinkgoContextTB()) tCtx = ktesting.WithContext(tCtx, ctx) + envName, dir := currentBinDir() + if dir == "" { + tCtx.Fatalf("%s must be set to test DRA upgrade/downgrade scenarios.", envName) + } + // Determine what we need to downgrade to. tCtx = ktesting.Begin(tCtx, "get source code version") gitVersion, _, err := sourceVersion(tCtx, repoRoot) @@ -214,7 +216,6 @@ var _ = ginkgo.Describe("DRA upgrade/downgrade", func() { // We could split this up into first updating the apiserver, then control plane components, then restarting kubelet. // For the purpose of this test here we we primarily care about full before/after comparisons, so not done yet. // TODO - _, dir := currentBinDir() restoreOptions := cluster.Modify(tCtx, localupcluster.ModifyOptions{Upgrade: true, BinDir: dir}) tCtx = ktesting.End(tCtx) diff --git a/test/integration/dra/cluster/.import-restrictions b/test/integration/dra/cluster/.import-restrictions deleted file mode 100644 index 4bd8b5005ec..00000000000 --- a/test/integration/dra/cluster/.import-restrictions +++ /dev/null @@ -1,5 +0,0 @@ -rules: - # This test is a Ginkgo suite and, in contrast to other integration tests, can use the E2E framework. - - selectorRegexp: k8s[.]io/kubernetes/test/e2e - allowedPrefixes: - - ""