Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

test: fix ginkgo failFast #3738

Merged
merged 2 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/community/running-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ The E2E test runner is designed to be flexible across a wide range of cluster co
| `TIMEOUT` | no | How much timeout tolerance for tests? Decrease timeout tolerance to do performance-type tests, increase to allow for more operational variability and possibly reduce flakes. E.g., `TIMEOUT=10m`. Default is 20m. |
| `LB_TIMEOUT` | no | How much timeout tolerance for Load Balancer tests? Decrease timeout tolerance to do performance-type tests, increase to allow for more operational variability and possibly reduce flakes. E.g., `LB_TIMEOUT=5m`. Default is 20m. |
| `GINKGO_FAIL_FAST` | no | Stop the suite right after the first failure? E.g., `GINKGO_FAIL_FAST=false`. Default is true. |
| `GINKGO_FOCUS` | no | Regular expression string to pass to test runner to run only a subset of tests that match the regular expression. E.g., `GINKGO_FOCUS="should be able to produce working LoadBalancers"`. Only works if `GINKGO_FAIL_FAST` is set to true. |
| `GINKGO_SKIP` | no | Regular expression string to pass to test runner to skip the subset of tests that match the regular expression. E.g., `GINKGO_SKIP="should be able to attach azure file"`. Only works if `GINKGO_FAIL_FAST` is set to true. |
| `GINKGO_FOCUS` | no | Regular expression string to pass to test runner to run only a subset of tests that match the regular expression. E.g., `GINKGO_FOCUS="should be able to produce working LoadBalancers"`. |
| `GINKGO_SKIP` | no | Regular expression string to pass to test runner to skip the subset of tests that match the regular expression. E.g., `GINKGO_SKIP="should be able to attach azure file"`. |
| `DEBUG_AFTERSUITE` | no | Print out Kubernetes resources and logs after E2E suite. This is especially useful if you have to delete your cluster after running the test and you wish to debug at a later time. E.g., `DEBUG_AFTERSUITE=true`. Default is false. |
2 changes: 1 addition & 1 deletion test/e2e/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type Config struct {
UseDeployCommand bool `envconfig:"USE_DEPLOY_COMMAND" default:"false"`
GinkgoFocus string `envconfig:"GINKGO_FOCUS" default:""`
GinkgoSkip string `envconfig:"GINKGO_SKIP" default:""`
GinkgoFailFast bool `envconfig:"GINKGO_FAIL_FAST" default:"true"`
GinkgoFailFast bool `envconfig:"GINKGO_FAIL_FAST" default:"false"`
DebugAfterSuite bool `envconfig:"DEBUG_AFTERSUITE" default:"false"`
BlockSSHPort bool `envconfig:"BLOCK_SSH" default:"false"`
AddNodePoolInput string `envconfig:"ADD_NODE_POOL_INPUT" default:""`
Expand Down
17 changes: 14 additions & 3 deletions test/e2e/runner/ginkgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,22 @@ func (g *Ginkgo) Run() error {
g.Point.SetTestStart()
// use the test bin rather than compile the directory b/c the compile will happen in a sub dir which is another module
testFile := fmt.Sprintf("test/e2e/%s/%s.test", g.Config.Orchestrator, g.Config.Orchestrator)
failFastFlag := ""

args := []string{"-slowSpecThreshold", "180", "-r", "-v"}
if g.Config.GinkgoFailFast {
failFastFlag = "--failFast"
args = append(args, "--failFast")
}
if g.Config.GinkgoFocus != "" {
args = append(args, "--focus")
args = append(args, g.Config.GinkgoFocus)
}
var cmd = exec.Command("ginkgo", "-slowSpecThreshold", "180", failFastFlag, "-r", "-v", "--focus", g.Config.GinkgoFocus, "--skip", g.Config.GinkgoSkip, testFile)
if g.Config.GinkgoSkip != "" {
args = append(args, "--skip")
args = append(args, g.Config.GinkgoSkip)
}
args = append(args, testFile)
var cmd = exec.Command("ginkgo", args...)

util.PrintCommand(cmd)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
Expand Down