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.
This commit is contained in:
Patrick Ohly
2025-07-14 18:35:52 +02:00
parent c8ca9249ac
commit 356be5ae30
6 changed files with 13 additions and 16 deletions

View File

@@ -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(/.*)?$'

View File

@@ -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

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package cluster
package e2edra
import (
"context"

View File

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

View File

@@ -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:
- ""