Skip to content

Commit

Permalink
Make ginkgo config configurable for E2E
Browse files Browse the repository at this point in the history
In ginkgo v2, the SuiteConfig and ReporterConfig are no
longer global and need to be passed to RunSpecs. 'subctl'
needs to be able to customize some of these fields so add
SuiteConfig and ReporterConfig fields to the TestContext to
facilitate this.

Note that TestContext.JunitReport was removed since the
equivalent field exists in ReporterConfig.

Signed-off-by: Tom Pantelis <[email protected]>
  • Loading branch information
tpantelis authored and dfarrell07 committed Jan 16, 2023
1 parent 47fd3c8 commit f9e9d9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 7 additions & 2 deletions test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,13 @@ func RunE2ETests(t *testing.T) bool {
gomega.RegisterFailHandler(Fail)

suiteConfig, reporterConfig := GinkgoConfiguration()
if framework.TestContext.JunitReport != "" {
reporterConfig.JUnitReport = framework.TestContext.JunitReport

if framework.TestContext.SuiteConfig != nil {
suiteConfig = *framework.TestContext.SuiteConfig
}

if framework.TestContext.ReporterConfig != nil {
reporterConfig = *framework.TestContext.ReporterConfig
}

return RunSpecs(t, "Submariner E2E suite", suiteConfig, reporterConfig)
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/framework/test_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,21 @@ import (
"os"
"strings"

"github.com/onsi/ginkgo/v2/types"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/klog/v2"
)

type contextArray []string

type TestContextType struct {
ReporterConfig *types.ReporterConfig
SuiteConfig *types.SuiteConfig
KubeConfigs []string // KubeConfigs provides an alternative to KubeConfig + KubeContexts
KubeConfig string
KubeContexts contextArray
ClusterIDs []string
NumNodesInCluster map[ClusterIndex]int
JunitReport string
SubmarinerNamespace string
ConnectionTimeout uint
ConnectionAttempts uint
Expand Down Expand Up @@ -66,8 +68,6 @@ func init() {
flag.StringVar(&TestContext.KubeConfig, "kubeconfig", os.Getenv("KUBECONFIG"),
"Path to kubeconfig containing embedded authinfo.")
flag.Var(&TestContext.KubeContexts, "dp-context", "kubeconfig context for dataplane clusters (use several times).")
flag.StringVar(&TestContext.JunitReport, "junit-report", "",
"Path to the directory and filename of the JUnit XML report. Default is empty, which doesn't generate these reports.")
flag.StringVar(&TestContext.SubmarinerNamespace, "submariner-namespace", "submariner",
"Namespace in which the submariner components are deployed.")
flag.UintVar(&TestContext.ConnectionTimeout, "connection-timeout", 18,
Expand Down

0 comments on commit f9e9d9e

Please sign in to comment.