Skip to content

Commit

Permalink
Expose ginkgo.focus and skip-globals flags in e2e_test
Browse files Browse the repository at this point in the history
Signed-off-by: James Munnelly <james@munnelly.eu>
  • Loading branch information
munnerz committed Apr 30, 2019
1 parent 546d3f1 commit 4197040
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ DOCKER_REPO :=
APP_VERSION := canary
HACK_DIR ?= hack

SKIP_GLOBALS := false
GINKGO_SKIP :=
GINKGO_FOCUS :=

## e2e test vars
KUBECTL ?= kubectl
Expand Down Expand Up @@ -118,6 +120,8 @@ e2e_test:
--repo-root="$$(pwd)" \
--report-dir="$${ARTIFACTS:-./_artifacts}" \
--ginkgo.skip="$(GINKGO_SKIP)" \
--ginkgo.focus="$(GINKGO_FOCUS)" \
--skip-globals=$(SKIP_GLOBALS) \
--kubectl-path="$(KUBECTL)"

# Generate targets
Expand Down
14 changes: 9 additions & 5 deletions test/e2e/e2e.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ var (
)

var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
addon.InitGlobals(cfg)
if !cfg.Addons.SkipGlobals {
addon.InitGlobals(cfg)
}

ginkgo.By("Provisioning shared cluster addons")

Expand Down Expand Up @@ -81,9 +83,11 @@ var _ = ginkgo.SynchronizedAfterSuite(func() {},
}
}

ginkgo.By("Cleaning up the provisioned globals")
err = addon.DeprovisionGlobals(cfg)
if err != nil {
framework.Failf("Error deprovisioning global addons: %v", err)
if !cfg.Addons.SkipGlobals {
ginkgo.By("Cleaning up the provisioned globals")
err = addon.DeprovisionGlobals(cfg)
if err != nil {
framework.Failf("Error deprovisioning global addons: %v", err)
}
}
})
7 changes: 7 additions & 0 deletions test/e2e/framework/config/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ type Addons struct {
// Venafi describes global configuration variables for the Venafi tests.
// This includes credentials for the Venafi TPP server to use during runs.
Venafi Venafi

// If true, global addons will not be provisioned before running tests.
// This is useful when developing locally.
SkipGlobals bool
}

func (a *Addons) AddFlags(fs *flag.FlagSet) {
Expand All @@ -48,6 +52,9 @@ func (a *Addons) AddFlags(fs *flag.FlagSet) {
a.Pebble.AddFlags(fs)
a.Nginx.AddFlags(fs)
a.Venafi.AddFlags(fs)

fs.BoolVar(&a.SkipGlobals, "skip-globals", false, "If true, global addons will not be "+
"provisioned before running tests")
}

func (c *Addons) Validate() []error {
Expand Down

0 comments on commit 4197040

Please sign in to comment.