Skip to content

Commit

Permalink
Simplify mysql tunnel setup in test helpers
Browse files Browse the repository at this point in the history
[#160768145]
  • Loading branch information
abg committed Sep 26, 2018
1 parent cc88330 commit dc0bd8e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions test_helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,17 +381,11 @@ func waitForTunnel(port int, serviceKey ServiceKey) {
serviceKey.Name,
)

Eventually(func() error {
db, err := sql.Open("mysql", connectionString)
if err != nil {
return err
}
defer func() {
e := db.Close()
Expect(e).NotTo(HaveOccurred())
}()
db, err := sql.Open("mysql", connectionString)
Expect(err).NotTo(HaveOccurred())
defer db.Close()

_, err = db.Exec("SELECT 1")
return err
Eventually(func() error {
return db.Ping()
}, "1m", "5s").Should(Not(HaveOccurred()))
}

0 comments on commit dc0bd8e

Please sign in to comment.