| Index: go/buildbot/buildbot_test.go
|
| diff --git a/go/buildbot/buildbot_test.go b/go/buildbot/buildbot_test.go
|
| index 9a7184be0e121e49fce24d789b48e48f5a1d3a85..bfecb32edbb3844d872f1545ef19e4650dcc1a37 100644
|
| --- a/go/buildbot/buildbot_test.go
|
| +++ b/go/buildbot/buildbot_test.go
|
| @@ -12,7 +12,6 @@ import (
|
|
|
| "github.com/golang/glog"
|
|
|
| - "skia.googlesource.com/buildbot.git/go/database"
|
| "skia.googlesource.com/buildbot.git/go/gitinfo"
|
| "skia.googlesource.com/buildbot.git/go/testutils"
|
| "skia.googlesource.com/buildbot.git/go/util"
|
| @@ -55,9 +54,9 @@ var (
|
|
|
| // clearDB initializes the database, upgrading it if needed, and removes all
|
| // data to ensure that the test begins with a clean slate.
|
| -func clearDB(t *testing.T, conf *database.DatabaseConfig) error {
|
| +func clearDB(t *testing.T) error {
|
| failMsg := "Database initialization failed. Do you have the test database set up properly? Details: %v"
|
| - if err := InitDB(conf); err != nil {
|
| + if err := InitDB(true); err != nil {
|
| t.Fatalf(failMsg, err)
|
| }
|
| tables := []string{
|
| @@ -107,7 +106,7 @@ func testGetBuildFromMaster(repo *gitinfo.GitInfo) (*Build, error) {
|
| // TestGetBuildFromMaster verifies that we can load JSON data from the build master and
|
| // decode it into a Build object.
|
| func TestGetBuildFromMaster(t *testing.T) {
|
| - clearDB(t, ProdDatabaseConfig(true))
|
| + clearDB(t)
|
|
|
| // Load the test repo.
|
| tr := util.NewTempRepo()
|
| @@ -131,9 +130,7 @@ func TestGetBuildFromMaster(t *testing.T) {
|
| // TestBuildJsonSerialization verifies that we can serialize a build to JSON
|
| // and back without losing or corrupting the data.
|
| func TestBuildJsonSerialization(t *testing.T) {
|
| - if err := clearDB(t, ProdDatabaseConfig(true)); err != nil {
|
| - t.Fatal(err)
|
| - }
|
| + clearDB(t)
|
|
|
| // Load the test repo.
|
| tr := util.NewTempRepo()
|
| @@ -163,9 +160,7 @@ func TestBuildJsonSerialization(t *testing.T) {
|
| // TestFindCommitsForBuild verifies that findCommitsForBuild correctly obtains
|
| // the list of commits which were newly built in a given build.
|
| func TestFindCommitsForBuild(t *testing.T) {
|
| - if err := clearDB(t, ProdDatabaseConfig(true)); err != nil {
|
| - t.Fatal(err)
|
| - }
|
| + clearDB(t)
|
|
|
| // Load the test repo.
|
| tr := util.NewTempRepo()
|
| @@ -283,8 +278,8 @@ func dbSerializeAndCompare(b1 *Build) error {
|
|
|
| // testBuildDbSerialization verifies that we can write a build to the DB and
|
| // pull it back out without losing or corrupting the data.
|
| -func testBuildDbSerialization(t *testing.T, conf *database.DatabaseConfig) {
|
| - clearDB(t, conf)
|
| +func testBuildDbSerialization(t *testing.T) {
|
| + clearDB(t)
|
| // Load the test repo.
|
| tr := util.NewTempRepo()
|
| defer tr.Cleanup()
|
| @@ -318,8 +313,8 @@ func testBuildDbSerialization(t *testing.T, conf *database.DatabaseConfig) {
|
| // testUnfinishedBuild verifies that we can write a build which is not yet
|
| // finished, load the build back from the database, and update it when it
|
| // finishes.
|
| -func testUnfinishedBuild(t *testing.T, conf *database.DatabaseConfig) {
|
| - clearDB(t, conf)
|
| +func testUnfinishedBuild(t *testing.T) {
|
| + clearDB(t)
|
| // Load the test repo.
|
| tr := util.NewTempRepo()
|
| defer tr.Cleanup()
|
| @@ -401,8 +396,8 @@ func testUnfinishedBuild(t *testing.T, conf *database.DatabaseConfig) {
|
|
|
| // testLastProcessedBuilds verifies that getLastProcessedBuilds gives us
|
| // the expected result.
|
| -func testLastProcessedBuilds(t *testing.T, conf *database.DatabaseConfig) {
|
| - clearDB(t, conf)
|
| +func testLastProcessedBuilds(t *testing.T) {
|
| + clearDB(t)
|
| // Load the test repo.
|
| tr := util.NewTempRepo()
|
| defer tr.Cleanup()
|
| @@ -522,9 +517,9 @@ func TestGetLatestBuilds(t *testing.T) {
|
| }
|
|
|
| // testGetUningestedBuilds verifies that getUningestedBuilds works as expected.
|
| -func testGetUningestedBuilds(t *testing.T, conf *database.DatabaseConfig) {
|
| +func testGetUningestedBuilds(t *testing.T) {
|
| // First, insert some builds into the database as a starting point.
|
| - clearDB(t, conf)
|
| + clearDB(t)
|
|
|
| // Load the test repo.
|
| tr := util.NewTempRepo()
|
| @@ -613,9 +608,9 @@ func testGetUningestedBuilds(t *testing.T, conf *database.DatabaseConfig) {
|
| // testIngestNewBuilds verifies that we can successfully query the masters and
|
| // the database for new and unfinished builds, respectively, and ingest them
|
| // into the database.
|
| -func testIngestNewBuilds(t *testing.T, conf *database.DatabaseConfig) {
|
| +func testIngestNewBuilds(t *testing.T) {
|
| // First, insert some builds into the database as a starting point.
|
| - clearDB(t, conf)
|
| + clearDB(t)
|
|
|
| // Load the test repo.
|
| tr := util.NewTempRepo()
|
| @@ -718,64 +713,37 @@ func testIngestNewBuilds(t *testing.T, conf *database.DatabaseConfig) {
|
| }
|
| }
|
|
|
| -func TestSQLiteBuildDbSerialization(t *testing.T) {
|
| - testBuildDbSerialization(t, ProdDatabaseConfig(true))
|
| -}
|
| -
|
| -func TestSQLiteUnfinishedBuild(t *testing.T) {
|
| - testUnfinishedBuild(t, ProdDatabaseConfig(true))
|
| -}
|
| -
|
| -func TestSQLiteLastProcessedBuilds(t *testing.T) {
|
| - testLastProcessedBuilds(t, ProdDatabaseConfig(true))
|
| -}
|
| -
|
| -func TestSQLiteGetUningestedBuilds(t *testing.T) {
|
| - testGetUningestedBuilds(t, ProdDatabaseConfig(true))
|
| -}
|
| -
|
| -func TestSQLiteIngestNewBuilds(t *testing.T) {
|
| - testIngestNewBuilds(t, ProdDatabaseConfig(true))
|
| -}
|
| -
|
| -// The below MySQL tests require:
|
| -// shell> mysql -u root
|
| -// mysql> CREATE DATABASE sk_testing;
|
| -// mysql> CREATE USER 'test_user'@'localhost';
|
| -// mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON sk_testing.* TO 'test_user'@'localhost';
|
| -//
|
| -// They are skipped when using the -short flag.
|
| func TestMySQLBuildDbSerialization(t *testing.T) {
|
| if testing.Short() {
|
| t.Skip("Skipping MySQL tests with -short.")
|
| }
|
| - testBuildDbSerialization(t, localMySQLTestDatabaseConfig("test_user", ""))
|
| + testBuildDbSerialization(t)
|
| }
|
|
|
| func TestMySQLUnfinishedBuild(t *testing.T) {
|
| if testing.Short() {
|
| t.Skip("Skipping MySQL tests with -short.")
|
| }
|
| - testUnfinishedBuild(t, localMySQLTestDatabaseConfig("test_user", ""))
|
| + testUnfinishedBuild(t)
|
| }
|
|
|
| func TestMySQLLastProcessedBuilds(t *testing.T) {
|
| if testing.Short() {
|
| t.Skip("Skipping MySQL tests with -short.")
|
| }
|
| - testLastProcessedBuilds(t, localMySQLTestDatabaseConfig("test_user", ""))
|
| + testLastProcessedBuilds(t)
|
| }
|
|
|
| func TestMySQLGetUningestedBuilds(t *testing.T) {
|
| if testing.Short() {
|
| t.Skip("Skipping MySQL tests with -short.")
|
| }
|
| - testGetUningestedBuilds(t, localMySQLTestDatabaseConfig("test_user", ""))
|
| + testGetUningestedBuilds(t)
|
| }
|
|
|
| func TestMySQLIngestNewBuilds(t *testing.T) {
|
| if testing.Short() {
|
| t.Skip("Skipping MySQL tests with -short.")
|
| }
|
| - testIngestNewBuilds(t, localMySQLTestDatabaseConfig("test_user", ""))
|
| + testIngestNewBuilds(t)
|
| }
|
|
|