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