| OLD | NEW |
| 1 package buildbot | 1 package buildbot |
| 2 | 2 |
| 3 import ( | 3 import ( |
| 4 "bytes" | 4 "bytes" |
| 5 "encoding/json" | 5 "encoding/json" |
| 6 "fmt" | 6 "fmt" |
| 7 "io" | 7 "io" |
| 8 "net/http" | 8 "net/http" |
| 9 "path/filepath" | 9 "path/filepath" |
| 10 "reflect" | 10 "reflect" |
| 11 "testing" | 11 "testing" |
| 12 | 12 |
| 13 "github.com/golang/glog" | 13 "github.com/golang/glog" |
| 14 | 14 |
| 15 » "skia.googlesource.com/buildbot.git/go/database" | 15 » "skia.googlesource.com/buildbot.git/go/database/testutil" |
| 16 "skia.googlesource.com/buildbot.git/go/gitinfo" | 16 "skia.googlesource.com/buildbot.git/go/gitinfo" |
| 17 "skia.googlesource.com/buildbot.git/go/testutils" | 17 "skia.googlesource.com/buildbot.git/go/testutils" |
| 18 "skia.googlesource.com/buildbot.git/go/util" | 18 "skia.googlesource.com/buildbot.git/go/util" |
| 19 ) | 19 ) |
| 20 | 20 |
| 21 var ( | 21 var ( |
| 22 // testJsonInput is raw JSON data as returned from the build master. | 22 // testJsonInput is raw JSON data as returned from the build master. |
| 23 testJsonInput = testutils.MustReadFile("default_build.json") | 23 testJsonInput = testutils.MustReadFile("default_build.json") |
| 24 | 24 |
| 25 // testIncompleteBuild is JSON data for a not-yet-finished build. | 25 // testIncompleteBuild is JSON data for a not-yet-finished build. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 47 "http://build.chromium.org/p/client.skia/json/builders/Test-Ubun
tu12-ShuttleA-GTX660-x86-Release/builds/721": []byte(testJsonInput
), | 47 "http://build.chromium.org/p/client.skia/json/builders/Test-Ubun
tu12-ShuttleA-GTX660-x86-Release/builds/721": []byte(testJsonInput
), |
| 48 "http://build.chromium.org/p/client.skia/json/builders/Test-Ubun
tu12-ShuttleA-GTX550Ti-x86_64-Release-Valgrind/builds/152": []byte(testIncomplet
eBuild), | 48 "http://build.chromium.org/p/client.skia/json/builders/Test-Ubun
tu12-ShuttleA-GTX550Ti-x86_64-Release-Valgrind/builds/152": []byte(testIncomplet
eBuild), |
| 49 "http://build.chromium.org/p/client.skia.android/json/builders/P
erf-Android-Venue8-PowerVR-x86-Release/builds/464": []byte(venue464), | 49 "http://build.chromium.org/p/client.skia.android/json/builders/P
erf-Android-Venue8-PowerVR-x86-Release/builds/464": []byte(venue464), |
| 50 "http://build.chromium.org/p/client.skia.android/json/builders/P
erf-Android-Venue8-PowerVR-x86-Release/builds/465": []byte(venue465), | 50 "http://build.chromium.org/p/client.skia.android/json/builders/P
erf-Android-Venue8-PowerVR-x86-Release/builds/465": []byte(venue465), |
| 51 "http://build.chromium.org/p/client.skia.android/json/builders/P
erf-Android-Venue8-PowerVR-x86-Release/builds/466": []byte(venue466), | 51 "http://build.chromium.org/p/client.skia.android/json/builders/P
erf-Android-Venue8-PowerVR-x86-Release/builds/466": []byte(venue466), |
| 52 "http://build.chromium.org/p/client.skia.fyi/json/builders/House
keeper-PerCommit/builds/1035": []byte(housekeeper10
35), | 52 "http://build.chromium.org/p/client.skia.fyi/json/builders/House
keeper-PerCommit/builds/1035": []byte(housekeeper10
35), |
| 53 } | 53 } |
| 54 ) | 54 ) |
| 55 | 55 |
| 56 // clearDB initializes the database, upgrading it if needed, and removes all | 56 // clearDB initializes the database, upgrading it if needed, and removes all |
| 57 // data to ensure that the test begins with a clean slate. | 57 // data to ensure that the test begins with a clean slate. Returns a MySQLTestDa
tabase |
| 58 func clearDB(t *testing.T, conf *database.DatabaseConfig) error { | 58 // which must be closed after the test finishes. |
| 59 func clearDB(t *testing.T) *testutil.MySQLTestDatabase { |
| 59 failMsg := "Database initialization failed. Do you have the test databas
e set up properly? Details: %v" | 60 failMsg := "Database initialization failed. Do you have the test databas
e set up properly? Details: %v" |
| 60 » if err := InitDB(conf); err != nil { | 61 |
| 62 » // Set up the database. |
| 63 » testDb := testutil.SetupMySQLTestDatabase(t, migrationSteps) |
| 64 |
| 65 » if err := InitDB(true); err != nil { |
| 61 t.Fatalf(failMsg, err) | 66 t.Fatalf(failMsg, err) |
| 62 } | 67 } |
| 63 » tables := []string{ | 68 |
| 64 » » TABLE_BUILD_REVISIONS, | 69 » return testDb |
| 65 » » TABLE_BUILD_STEPS, | |
| 66 » » TABLE_BUILDS, | |
| 67 » } | |
| 68 » // Delete the data. | |
| 69 » for _, table := range tables { | |
| 70 » » _, err := DB.Exec(fmt.Sprintf("DELETE FROM %s;", table)) | |
| 71 » » if err != nil { | |
| 72 » » » t.Fatalf(failMsg, err) | |
| 73 » » } | |
| 74 » } | |
| 75 » return nil | |
| 76 } | 70 } |
| 77 | 71 |
| 78 // respBodyCloser is a wrapper which lets us pretend to implement io.ReadCloser | 72 // respBodyCloser is a wrapper which lets us pretend to implement io.ReadCloser |
| 79 // by wrapping a bytes.Reader. | 73 // by wrapping a bytes.Reader. |
| 80 type respBodyCloser struct { | 74 type respBodyCloser struct { |
| 81 io.Reader | 75 io.Reader |
| 82 } | 76 } |
| 83 | 77 |
| 84 // Close is a stub method which lets us pretend to implement io.ReadCloser. | 78 // Close is a stub method which lets us pretend to implement io.ReadCloser. |
| 85 func (r respBodyCloser) Close() error { | 79 func (r respBodyCloser) Close() error { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 100 // testGetBuild is a helper function which pretends to load JSON data from a | 94 // testGetBuild is a helper function which pretends to load JSON data from a |
| 101 // build master and decodes it into a Build object. | 95 // build master and decodes it into a Build object. |
| 102 func testGetBuildFromMaster(repo *gitinfo.GitInfo) (*Build, error) { | 96 func testGetBuildFromMaster(repo *gitinfo.GitInfo) (*Build, error) { |
| 103 httpGet = testGet | 97 httpGet = testGet |
| 104 return getBuildFromMaster("client.skia", "Test-Ubuntu12-ShuttleA-GTX660-
x86-Release", 721, repo) | 98 return getBuildFromMaster("client.skia", "Test-Ubuntu12-ShuttleA-GTX660-
x86-Release", 721, repo) |
| 105 } | 99 } |
| 106 | 100 |
| 107 // TestGetBuildFromMaster verifies that we can load JSON data from the build mas
ter and | 101 // TestGetBuildFromMaster verifies that we can load JSON data from the build mas
ter and |
| 108 // decode it into a Build object. | 102 // decode it into a Build object. |
| 109 func TestGetBuildFromMaster(t *testing.T) { | 103 func TestGetBuildFromMaster(t *testing.T) { |
| 110 » clearDB(t, ProdDatabaseConfig(true)) | 104 » d := clearDB(t) |
| 105 » defer d.Close() |
| 111 | 106 |
| 112 // Load the test repo. | 107 // Load the test repo. |
| 113 tr := util.NewTempRepo() | 108 tr := util.NewTempRepo() |
| 114 defer tr.Cleanup() | 109 defer tr.Cleanup() |
| 115 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) | 110 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) |
| 116 if err != nil { | 111 if err != nil { |
| 117 t.Fatal(err) | 112 t.Fatal(err) |
| 118 } | 113 } |
| 119 | 114 |
| 120 // Default, complete build. | 115 // Default, complete build. |
| 121 if _, err := testGetBuildFromMaster(repo); err != nil { | 116 if _, err := testGetBuildFromMaster(repo); err != nil { |
| 122 t.Fatal(err) | 117 t.Fatal(err) |
| 123 } | 118 } |
| 124 // Incomplete build. | 119 // Incomplete build. |
| 125 _, err = getBuildFromMaster("client.skia", "Test-Ubuntu12-ShuttleA-GTX55
0Ti-x86_64-Release-Valgrind", 152, repo) | 120 _, err = getBuildFromMaster("client.skia", "Test-Ubuntu12-ShuttleA-GTX55
0Ti-x86_64-Release-Valgrind", 152, repo) |
| 126 if err != nil { | 121 if err != nil { |
| 127 t.Fatal(err) | 122 t.Fatal(err) |
| 128 } | 123 } |
| 129 } | 124 } |
| 130 | 125 |
| 131 // TestBuildJsonSerialization verifies that we can serialize a build to JSON | 126 // TestBuildJsonSerialization verifies that we can serialize a build to JSON |
| 132 // and back without losing or corrupting the data. | 127 // and back without losing or corrupting the data. |
| 133 func TestBuildJsonSerialization(t *testing.T) { | 128 func TestBuildJsonSerialization(t *testing.T) { |
| 134 » if err := clearDB(t, ProdDatabaseConfig(true)); err != nil { | 129 » d := clearDB(t) |
| 135 » » t.Fatal(err) | 130 » defer d.Close() |
| 136 » } | |
| 137 | 131 |
| 138 // Load the test repo. | 132 // Load the test repo. |
| 139 tr := util.NewTempRepo() | 133 tr := util.NewTempRepo() |
| 140 defer tr.Cleanup() | 134 defer tr.Cleanup() |
| 141 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) | 135 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) |
| 142 if err != nil { | 136 if err != nil { |
| 143 t.Fatal(err) | 137 t.Fatal(err) |
| 144 } | 138 } |
| 145 | 139 |
| 146 b1, err := testGetBuildFromMaster(repo) | 140 b1, err := testGetBuildFromMaster(repo) |
| 147 if err != nil { | 141 if err != nil { |
| 148 t.Fatal(err) | 142 t.Fatal(err) |
| 149 } | 143 } |
| 150 bytes, err := json.Marshal(b1) | 144 bytes, err := json.Marshal(b1) |
| 151 if err != nil { | 145 if err != nil { |
| 152 t.Fatal(err) | 146 t.Fatal(err) |
| 153 } | 147 } |
| 154 b2 := &Build{} | 148 b2 := &Build{} |
| 155 if err := json.Unmarshal(bytes, b2); err != nil { | 149 if err := json.Unmarshal(bytes, b2); err != nil { |
| 156 t.Fatal(err) | 150 t.Fatal(err) |
| 157 } | 151 } |
| 158 if !reflect.DeepEqual(b1, b2) { | 152 if !reflect.DeepEqual(b1, b2) { |
| 159 t.Fatalf("Serialization diff:\nIn: %v\nOut: %v", b1, b2) | 153 t.Fatalf("Serialization diff:\nIn: %v\nOut: %v", b1, b2) |
| 160 } | 154 } |
| 161 } | 155 } |
| 162 | 156 |
| 163 // TestFindCommitsForBuild verifies that findCommitsForBuild correctly obtains | 157 // TestFindCommitsForBuild verifies that findCommitsForBuild correctly obtains |
| 164 // the list of commits which were newly built in a given build. | 158 // the list of commits which were newly built in a given build. |
| 165 func TestFindCommitsForBuild(t *testing.T) { | 159 func TestFindCommitsForBuild(t *testing.T) { |
| 166 » if err := clearDB(t, ProdDatabaseConfig(true)); err != nil { | 160 » d := clearDB(t) |
| 167 » » t.Fatal(err) | 161 » defer d.Close() |
| 168 » } | |
| 169 | 162 |
| 170 // Load the test repo. | 163 // Load the test repo. |
| 171 tr := util.NewTempRepo() | 164 tr := util.NewTempRepo() |
| 172 defer tr.Cleanup() | 165 defer tr.Cleanup() |
| 173 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) | 166 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) |
| 174 if err != nil { | 167 if err != nil { |
| 175 t.Fatal(err) | 168 t.Fatal(err) |
| 176 } | 169 } |
| 177 | 170 |
| 178 // The test repo is laid out like this: | 171 // The test repo is laid out like this: |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 glog.Errorf("Not equal:\n %+v\n %+v\n", s, b2.St
eps[i]) | 269 glog.Errorf("Not equal:\n %+v\n %+v\n", s, b2.St
eps[i]) |
| 277 } | 270 } |
| 278 } | 271 } |
| 279 return fmt.Errorf("Builds are not equal! Builds:\nExpected: %+v\
nActual: %+v", b1, b2) | 272 return fmt.Errorf("Builds are not equal! Builds:\nExpected: %+v\
nActual: %+v", b1, b2) |
| 280 } | 273 } |
| 281 return nil | 274 return nil |
| 282 } | 275 } |
| 283 | 276 |
| 284 // testBuildDbSerialization verifies that we can write a build to the DB and | 277 // testBuildDbSerialization verifies that we can write a build to the DB and |
| 285 // pull it back out without losing or corrupting the data. | 278 // pull it back out without losing or corrupting the data. |
| 286 func testBuildDbSerialization(t *testing.T, conf *database.DatabaseConfig) { | 279 func testBuildDbSerialization(t *testing.T) { |
| 287 » clearDB(t, conf) | 280 » d := clearDB(t) |
| 281 » defer d.Close() |
| 282 |
| 288 // Load the test repo. | 283 // Load the test repo. |
| 289 tr := util.NewTempRepo() | 284 tr := util.NewTempRepo() |
| 290 defer tr.Cleanup() | 285 defer tr.Cleanup() |
| 291 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) | 286 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) |
| 292 if err != nil { | 287 if err != nil { |
| 293 t.Fatal(err) | 288 t.Fatal(err) |
| 294 } | 289 } |
| 295 | 290 |
| 296 // Test case: an empty build. Tests null and empty values. | 291 // Test case: an empty build. Tests null and empty values. |
| 297 emptyTime := 0.0 | 292 emptyTime := 0.0 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 311 for _, b := range testCases { | 306 for _, b := range testCases { |
| 312 if err = dbSerializeAndCompare(b); err != nil { | 307 if err = dbSerializeAndCompare(b); err != nil { |
| 313 t.Fatal(err) | 308 t.Fatal(err) |
| 314 } | 309 } |
| 315 } | 310 } |
| 316 } | 311 } |
| 317 | 312 |
| 318 // testUnfinishedBuild verifies that we can write a build which is not yet | 313 // testUnfinishedBuild verifies that we can write a build which is not yet |
| 319 // finished, load the build back from the database, and update it when it | 314 // finished, load the build back from the database, and update it when it |
| 320 // finishes. | 315 // finishes. |
| 321 func testUnfinishedBuild(t *testing.T, conf *database.DatabaseConfig) { | 316 func testUnfinishedBuild(t *testing.T) { |
| 322 » clearDB(t, conf) | 317 » d := clearDB(t) |
| 318 » defer d.Close() |
| 319 |
| 323 // Load the test repo. | 320 // Load the test repo. |
| 324 tr := util.NewTempRepo() | 321 tr := util.NewTempRepo() |
| 325 defer tr.Cleanup() | 322 defer tr.Cleanup() |
| 326 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) | 323 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) |
| 327 if err != nil { | 324 if err != nil { |
| 328 t.Fatal(err) | 325 t.Fatal(err) |
| 329 } | 326 } |
| 330 | 327 |
| 331 // Obtain and insert an unfinished build. | 328 // Obtain and insert an unfinished build. |
| 332 httpGet = testGet | 329 httpGet = testGet |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 break | 391 break |
| 395 } | 392 } |
| 396 } | 393 } |
| 397 if found { | 394 if found { |
| 398 t.Fatal(fmt.Errorf("Finished build was found by getUnfinishedBui
lds!")) | 395 t.Fatal(fmt.Errorf("Finished build was found by getUnfinishedBui
lds!")) |
| 399 } | 396 } |
| 400 } | 397 } |
| 401 | 398 |
| 402 // testLastProcessedBuilds verifies that getLastProcessedBuilds gives us | 399 // testLastProcessedBuilds verifies that getLastProcessedBuilds gives us |
| 403 // the expected result. | 400 // the expected result. |
| 404 func testLastProcessedBuilds(t *testing.T, conf *database.DatabaseConfig) { | 401 func testLastProcessedBuilds(t *testing.T) { |
| 405 » clearDB(t, conf) | 402 » d := clearDB(t) |
| 403 » defer d.Close() |
| 404 |
| 406 // Load the test repo. | 405 // Load the test repo. |
| 407 tr := util.NewTempRepo() | 406 tr := util.NewTempRepo() |
| 408 defer tr.Cleanup() | 407 defer tr.Cleanup() |
| 409 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) | 408 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) |
| 410 if err != nil { | 409 if err != nil { |
| 411 t.Fatal(err) | 410 t.Fatal(err) |
| 412 } | 411 } |
| 413 | 412 |
| 414 build, err := testGetBuildFromMaster(repo) | 413 build, err := testGetBuildFromMaster(repo) |
| 415 if err != nil { | 414 if err != nil { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 actual, err := getLatestBuilds() | 514 actual, err := getLatestBuilds() |
| 516 if err != nil { | 515 if err != nil { |
| 517 t.Fatal(err) | 516 t.Fatal(err) |
| 518 } | 517 } |
| 519 if !reflect.DeepEqual(expected, actual) { | 518 if !reflect.DeepEqual(expected, actual) { |
| 520 t.Fatal(fmt.Errorf("getLatestBuilds returned incorrect results:
%v", actual)) | 519 t.Fatal(fmt.Errorf("getLatestBuilds returned incorrect results:
%v", actual)) |
| 521 } | 520 } |
| 522 } | 521 } |
| 523 | 522 |
| 524 // testGetUningestedBuilds verifies that getUningestedBuilds works as expected. | 523 // testGetUningestedBuilds verifies that getUningestedBuilds works as expected. |
| 525 func testGetUningestedBuilds(t *testing.T, conf *database.DatabaseConfig) { | 524 func testGetUningestedBuilds(t *testing.T) { |
| 526 » // First, insert some builds into the database as a starting point. | 525 » d := clearDB(t) |
| 527 » clearDB(t, conf) | 526 » defer d.Close() |
| 528 | 527 |
| 529 // Load the test repo. | 528 // Load the test repo. |
| 530 tr := util.NewTempRepo() | 529 tr := util.NewTempRepo() |
| 531 defer tr.Cleanup() | 530 defer tr.Cleanup() |
| 532 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) | 531 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) |
| 533 if err != nil { | 532 if err != nil { |
| 534 t.Fatal(err) | 533 t.Fatal(err) |
| 535 } | 534 } |
| 536 | 535 |
| 537 // This builder is no longer found on the master. | 536 // This builder is no longer found on the master. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 t.Fatal(err) | 605 t.Fatal(err) |
| 607 } | 606 } |
| 608 if !reflect.DeepEqual(expected, actual) { | 607 if !reflect.DeepEqual(expected, actual) { |
| 609 t.Fatal(fmt.Errorf("getUningestedBuilds returned incorrect resul
ts: %v", actual)) | 608 t.Fatal(fmt.Errorf("getUningestedBuilds returned incorrect resul
ts: %v", actual)) |
| 610 } | 609 } |
| 611 } | 610 } |
| 612 | 611 |
| 613 // testIngestNewBuilds verifies that we can successfully query the masters and | 612 // testIngestNewBuilds verifies that we can successfully query the masters and |
| 614 // the database for new and unfinished builds, respectively, and ingest them | 613 // the database for new and unfinished builds, respectively, and ingest them |
| 615 // into the database. | 614 // into the database. |
| 616 func testIngestNewBuilds(t *testing.T, conf *database.DatabaseConfig) { | 615 func testIngestNewBuilds(t *testing.T) { |
| 617 » // First, insert some builds into the database as a starting point. | 616 » d := clearDB(t) |
| 618 » clearDB(t, conf) | 617 » defer d.Close() |
| 619 | 618 |
| 620 // Load the test repo. | 619 // Load the test repo. |
| 621 tr := util.NewTempRepo() | 620 tr := util.NewTempRepo() |
| 622 defer tr.Cleanup() | 621 defer tr.Cleanup() |
| 623 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) | 622 repo, err := gitinfo.NewGitInfo(filepath.Join(tr.Dir, "testrepo"), false
, true) |
| 624 if err != nil { | 623 if err != nil { |
| 625 t.Fatal(err) | 624 t.Fatal(err) |
| 626 } | 625 } |
| 627 | 626 |
| 628 // This builder needs to load a few builds. | 627 // This builder needs to load a few builds. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 } | 710 } |
| 712 if !(a.MasterName == e.MasterName && a.BuilderName == e.BuilderN
ame && a.Number == e.Number) { | 711 if !(a.MasterName == e.MasterName && a.BuilderName == e.BuilderN
ame && a.Number == e.Number) { |
| 713 t.Fatalf("Incorrect build was inserted! %v", a) | 712 t.Fatalf("Incorrect build was inserted! %v", a) |
| 714 } | 713 } |
| 715 if !a.IsFinished() { | 714 if !a.IsFinished() { |
| 716 t.Fatalf("Failed to update build properly; it should be
finished: %v", a) | 715 t.Fatalf("Failed to update build properly; it should be
finished: %v", a) |
| 717 } | 716 } |
| 718 } | 717 } |
| 719 } | 718 } |
| 720 | 719 |
| 721 func TestSQLiteBuildDbSerialization(t *testing.T) { | |
| 722 testBuildDbSerialization(t, ProdDatabaseConfig(true)) | |
| 723 } | |
| 724 | |
| 725 func TestSQLiteUnfinishedBuild(t *testing.T) { | |
| 726 testUnfinishedBuild(t, ProdDatabaseConfig(true)) | |
| 727 } | |
| 728 | |
| 729 func TestSQLiteLastProcessedBuilds(t *testing.T) { | |
| 730 testLastProcessedBuilds(t, ProdDatabaseConfig(true)) | |
| 731 } | |
| 732 | |
| 733 func TestSQLiteGetUningestedBuilds(t *testing.T) { | |
| 734 testGetUningestedBuilds(t, ProdDatabaseConfig(true)) | |
| 735 } | |
| 736 | |
| 737 func TestSQLiteIngestNewBuilds(t *testing.T) { | |
| 738 testIngestNewBuilds(t, ProdDatabaseConfig(true)) | |
| 739 } | |
| 740 | |
| 741 // The below MySQL tests require: | |
| 742 // shell> mysql -u root | |
| 743 // mysql> CREATE DATABASE sk_testing; | |
| 744 // mysql> CREATE USER 'test_user'@'localhost'; | |
| 745 // mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON sk_testing.* TO 'test
_user'@'localhost'; | |
| 746 // | |
| 747 // They are skipped when using the -short flag. | |
| 748 func TestMySQLBuildDbSerialization(t *testing.T) { | 720 func TestMySQLBuildDbSerialization(t *testing.T) { |
| 749 if testing.Short() { | 721 if testing.Short() { |
| 750 t.Skip("Skipping MySQL tests with -short.") | 722 t.Skip("Skipping MySQL tests with -short.") |
| 751 } | 723 } |
| 752 » testBuildDbSerialization(t, localMySQLTestDatabaseConfig("test_user", ""
)) | 724 » testBuildDbSerialization(t) |
| 753 } | 725 } |
| 754 | 726 |
| 755 func TestMySQLUnfinishedBuild(t *testing.T) { | 727 func TestMySQLUnfinishedBuild(t *testing.T) { |
| 756 if testing.Short() { | 728 if testing.Short() { |
| 757 t.Skip("Skipping MySQL tests with -short.") | 729 t.Skip("Skipping MySQL tests with -short.") |
| 758 } | 730 } |
| 759 » testUnfinishedBuild(t, localMySQLTestDatabaseConfig("test_user", "")) | 731 » testUnfinishedBuild(t) |
| 760 } | 732 } |
| 761 | 733 |
| 762 func TestMySQLLastProcessedBuilds(t *testing.T) { | 734 func TestMySQLLastProcessedBuilds(t *testing.T) { |
| 763 if testing.Short() { | 735 if testing.Short() { |
| 764 t.Skip("Skipping MySQL tests with -short.") | 736 t.Skip("Skipping MySQL tests with -short.") |
| 765 } | 737 } |
| 766 » testLastProcessedBuilds(t, localMySQLTestDatabaseConfig("test_user", "")
) | 738 » testLastProcessedBuilds(t) |
| 767 } | 739 } |
| 768 | 740 |
| 769 func TestMySQLGetUningestedBuilds(t *testing.T) { | 741 func TestMySQLGetUningestedBuilds(t *testing.T) { |
| 770 if testing.Short() { | 742 if testing.Short() { |
| 771 t.Skip("Skipping MySQL tests with -short.") | 743 t.Skip("Skipping MySQL tests with -short.") |
| 772 } | 744 } |
| 773 » testGetUningestedBuilds(t, localMySQLTestDatabaseConfig("test_user", "")
) | 745 » testGetUningestedBuilds(t) |
| 774 } | 746 } |
| 775 | 747 |
| 776 func TestMySQLIngestNewBuilds(t *testing.T) { | 748 func TestMySQLIngestNewBuilds(t *testing.T) { |
| 777 if testing.Short() { | 749 if testing.Short() { |
| 778 t.Skip("Skipping MySQL tests with -short.") | 750 t.Skip("Skipping MySQL tests with -short.") |
| 779 } | 751 } |
| 780 » testIngestNewBuilds(t, localMySQLTestDatabaseConfig("test_user", "")) | 752 » testIngestNewBuilds(t) |
| 781 } | 753 } |
| OLD | NEW |