Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sanity: support embedding tests multiple time in Ginkgo, II #255

Merged
merged 1 commit into from
Mar 23, 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
10 changes: 3 additions & 7 deletions pkg/sanity/sanity.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,10 @@ func NewTestConfig() TestConfig {
}
}

// newContext sets up sanity testing with a config supplied by the
// NewContext sets up sanity testing with a config supplied by the
// user of the sanity package. Ownership of that config is shared
// between the sanity package and the caller.
func newTestContext(config *TestConfig) *TestContext {
func NewTestContext(config *TestConfig) *TestContext {
return &TestContext{
Config: config,
}
Expand Down Expand Up @@ -231,12 +231,8 @@ func Test(t GinkgoTestingT, config TestConfig) {
// GinkgoTest for use when the tests run. Therefore its content can
// still be modified in a BeforeEach. The sanity package itself treats
// it as read-only.
//
// Only tests defined with DescribeSanity after the last invocation with
// GinkgoTest (if there has be one) will be added, i.e. each test only
// gets added at most once.
func GinkgoTest(config *TestConfig) *TestContext {
sc := newTestContext(config)
sc := NewTestContext(config)
registerTestsInGinkgo(sc)
return sc
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/sanity/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,4 @@ func registerTestsInGinkgo(sc *TestContext) {
})
})
}
// Don't register tests more than once! More tests might
// be added later in a different context, followed by
// another registerTestsInGinkgo call.
tests = nil
}