From a9b64025cd49bfa9e5a6a3e23ed90447a3dfd79c Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 27 Apr 2022 09:54:56 +0200 Subject: [PATCH] test: run OLM tests first, III Top-level nodes were still getting randomized (https://github.com/onsi/ginkgo/issues/966#issuecomment-1110046593). --- test/e2e/deploy/deploy.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/e2e/deploy/deploy.go b/test/e2e/deploy/deploy.go index 311d97fb3..6daafcf18 100644 --- a/test/e2e/deploy/deploy.go +++ b/test/e2e/deploy/deploy.go @@ -32,6 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/util/wait" + "k8s.io/klog/v2" "k8s.io/klog/v2/klogr" "k8s.io/kubernetes/test/e2e/framework" "k8s.io/kubernetes/test/e2e/framework/skipper" @@ -1511,7 +1512,19 @@ func Describe(deployment, describe, what string, f func(d *Deployment)) bool { } // DefineTests must be called to register all tests defined so far via Describe. +// +// They are placed inside a "Deploy" node because: +// - The order of specs inside a node is not randomized by default, +// which is what we want, in contrast to the top-level nodes, +// which always get randomized (https://github.com/onsi/ginkgo/issues/966#issuecomment-1110046593). +// - It is easier to focus on specific tests with, for example, "Deploy operator". +// "^operator" does not work because the internal test name string has some +// builtin, hidden string at the beginning (something like "top level"). func DefineTests() { + ginkgo.Context("Deploy", defineTests) +} + +func defineTests() { all := allDeployments[:] for deploymentName := range tests { if !haveDeployment(all, deploymentName) { @@ -1527,6 +1540,7 @@ func DefineTests() { deploymentName := deploymentName for describe, funcs := range group { funcs := funcs + klog.InfoS("defining tests", "deployment", deploymentName, "test", describe) ginkgo.Describe(describe, func() { var deployment *Deployment if deploymentName != "" {