package db_test

import (
	"cred-alert/mysqlrunner"
	"fmt"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestDB(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "DB Suite")
}

var dbRunner mysqlrunner.Runner

var _ = BeforeSuite(func() {
	dbRunner = mysqlrunner.Runner{
		DBName: fmt.Sprintf("testdb_%d", GinkgoParallelNode()),
	}
	dbRunner.Setup()
})

var _ = AfterSuite(func() {
	dbRunner.Teardown()
})

package db_test

import (
	"cred-alert/mysqlrunner"
	"fmt"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"

	"testing"
)

func TestDB(t *testing.T) {
	RegisterFailHandler(Fail)
	RunSpecs(t, "DB Suite")
}

var dbRunner mysqlrunner.Runner

var _ = BeforeSuite(func() {
	dbRunner = mysqlrunner.Runner{
		DBName: fmt.Sprintf("testdb_%d", GinkgoParallelNode()),
	}
	dbRunner.Setup()
})

var _ = AfterSuite(func() {
	dbRunner.Teardown()
})

var _ = AfterEach(func() {
	dbRunner.Truncate()
})

Truncate test db in AfterEach
Truncate test db in AfterEach

[#128790261]

Signed-off-by: Christopher Brown <eb0819782e2e967e3d4f4d71eab0c647ed2659cf@pivotal.io>
