Skip to content

Commit

Permalink
dropdb when failed
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Lin committed Aug 17, 2018
1 parent 5733474 commit 3bfe35e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ func init() {

func TestMain(m *testing.M) {
v := m.Run()
if v == 0 && failedDropTestDatabase() {
os.Exit(1)
if v != 0 {
dropTestDatabase()
}
os.Exit(v)
}

// Drop test database
func failedDropTestDatabase() bool {
func dropTestDatabase() bool {
cf := config.MustRead("../../config/testing.json")
sp := serviceprovider.NewForTesting(cf)
session := sp.Mongo.NewSession()
Expand Down

0 comments on commit 3bfe35e

Please sign in to comment.