mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-19 09:52:49 +00:00
Set Ginkgo config by the method of GinkgoConfiguration()
Signed-off-by: Dave Chen <dave.chen@arm.com>
This commit is contained in:
parent
46a3954ba5
commit
5ac8105b86
@ -104,10 +104,6 @@ func RunE2ETests(t *testing.T) {
|
||||
defer logs.FlushLogs()
|
||||
progressReporter = e2ereporters.NewProgressReporter(framework.TestContext.ProgressReportURL)
|
||||
gomega.RegisterFailHandler(framework.Fail)
|
||||
// Disable skipped tests unless they are explicitly requested.
|
||||
if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" {
|
||||
config.GinkgoConfig.SkipString = `\[Flaky\]|\[Feature:.+\]`
|
||||
}
|
||||
|
||||
// Run tests through the Ginkgo runner with output to console + JUnit for Jenkins
|
||||
var r []ginkgo.Reporter
|
||||
@ -121,8 +117,9 @@ func RunE2ETests(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
klog.Infof("Starting e2e run %q on Ginkgo node %d", framework.RunID, config.GinkgoConfig.ParallelNode)
|
||||
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r)
|
||||
suiteConfig, reporterConfig := framework.CreateGinkgoConfig()
|
||||
klog.Infof("Starting e2e run %q on Ginkgo node %d", framework.RunID, suiteConfig.ParallelProcess)
|
||||
ginkgo.RunSpecs(t, "Kubernetes e2e suite", suiteConfig, reporterConfig)
|
||||
}
|
||||
|
||||
// getDefaultClusterIPFamily obtains the default IP family of the cluster
|
||||
|
@ -28,7 +28,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/onsi/ginkgo/v2/config"
|
||||
"github.com/onsi/ginkgo/v2"
|
||||
"github.com/onsi/ginkgo/v2/types"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
clientcmdapi "k8s.io/client-go/tools/clientcmd/api"
|
||||
@ -276,15 +277,6 @@ func (tc TestContextType) ClusterIsIPv6() bool {
|
||||
// options themselves, copy flags from test/e2e/framework/config
|
||||
// as shown in HandleFlags.
|
||||
func RegisterCommonFlags(flags *flag.FlagSet) {
|
||||
// Turn on verbose by default to get spec names
|
||||
config.DefaultReporterConfig.Verbose = true
|
||||
|
||||
// Turn on EmitSpecProgress to get spec progress (especially on interrupt)
|
||||
config.GinkgoConfig.EmitSpecProgress = true
|
||||
|
||||
// Randomize specs as well as suites
|
||||
config.GinkgoConfig.RandomizeAllSpecs = true
|
||||
|
||||
flags.StringVar(&TestContext.GatherKubeSystemResourceUsageData, "gather-resource-usage", "false", "If set to 'true' or 'all' framework will be monitoring resource usage of system all add-ons in (some) e2e tests, if set to 'master' framework will be monitoring master node only, if set to 'none' of 'false' monitoring will be turned off.")
|
||||
flags.BoolVar(&TestContext.GatherLogsSizes, "gather-logs-sizes", false, "If set to true framework will be monitoring logs sizes on all machines running e2e tests.")
|
||||
flags.IntVar(&TestContext.MaxNodesToGather, "max-nodes-to-gather-from", 20, "The maximum number of nodes to gather extended info from on test failure.")
|
||||
@ -327,6 +319,22 @@ func RegisterCommonFlags(flags *flag.FlagSet) {
|
||||
flags.IntVar(&TestContext.SnapshotControllerHTTPPort, "snapshot-controller-http-port", 0, "The port to use for snapshot controller HTTP communication.")
|
||||
}
|
||||
|
||||
func CreateGinkgoConfig() (types.SuiteConfig, types.ReporterConfig) {
|
||||
// fetch the current config
|
||||
suiteConfig, reporterConfig := ginkgo.GinkgoConfiguration()
|
||||
// Turn on EmitSpecProgress to get spec progress (especially on interrupt)
|
||||
suiteConfig.EmitSpecProgress = true
|
||||
// Randomize specs as well as suites
|
||||
suiteConfig.RandomizeAllSpecs = true
|
||||
// Turn on verbose by default to get spec names
|
||||
reporterConfig.Verbose = true
|
||||
// Disable skipped tests unless they are explicitly requested.
|
||||
if len(suiteConfig.FocusStrings) == 0 && len(suiteConfig.SkipStrings) == 0 {
|
||||
suiteConfig.SkipStrings = []string{`\[Flaky\]|\[Feature:.+\]`}
|
||||
}
|
||||
return suiteConfig, reporterConfig
|
||||
}
|
||||
|
||||
// RegisterClusterFlags registers flags specific to the cluster e2e test suite.
|
||||
func RegisterClusterFlags(flags *flag.FlagSet) {
|
||||
flags.BoolVar(&TestContext.VerifyServiceAccount, "e2e-verify-service-account", true, "If true tests will verify the service account before running.")
|
||||
|
@ -59,5 +59,6 @@ func TestE2E(t *testing.T) {
|
||||
reporters = append(reporters, morereporters.NewJUnitReporter(junitPath))
|
||||
}
|
||||
}
|
||||
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "E2EKubeadm suite", reporters)
|
||||
suiteConfig, reporterConfig := framework.CreateGinkgoConfig()
|
||||
ginkgo.RunSpecs(t, "E2EKubeadm suite", suiteConfig, reporterConfig)
|
||||
}
|
||||
|
@ -192,7 +192,8 @@ func TestE2eNode(t *testing.T) {
|
||||
reporters = append(reporters, morereporters.NewJUnitReporter(junitPath))
|
||||
}
|
||||
}
|
||||
ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "E2eNode Suite", reporters)
|
||||
suiteConfig, reporterConfig := framework.CreateGinkgoConfig()
|
||||
ginkgo.RunSpecs(t, "E2eNode Suite", suiteConfig, reporterConfig)
|
||||
}
|
||||
|
||||
// Setup the kubelet on the node
|
||||
|
Loading…
Reference in New Issue
Block a user