Skip to content

Commit

Permalink
pkg/sanity: close connection last
Browse files Browse the repository at this point in the history
Ginkgo invokes AfterEach in the order in which they are defined,
therefore we should define the AfterEach where the connection is closed
as late as possible. That way the tests can have their own AfterEach
where they can still use the connection.
  • Loading branch information
pohly committed Jul 11, 2018
1 parent a32d1ae commit 437c0f5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/sanity/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ func DescribeSanity(text string, body func(*SanityContext)) bool {
func registerTestsInGinkgo(sc *SanityContext) {
for _, test := range tests {
Describe(test.text, func() {

BeforeEach(func() {
sc.setup()
})

test.body(sc)

AfterEach(func() {
sc.teardown()
})

test.body(sc)
})
}
}

0 comments on commit 437c0f5

Please sign in to comment.