Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Unified Diff: golden/go/skiacorrectness/main.go

Issue 813443002: Overhaul database package (Closed) Base URL: https://skia.googlesource.com/buildbot@master
Patch Set: Fix newline in password Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: golden/go/skiacorrectness/main.go
diff --git a/golden/go/skiacorrectness/main.go b/golden/go/skiacorrectness/main.go
index c1493e42438caec81896ca5519854c8422cbad1f..4ad2c470d4717347eac37b6316ad5c055ce15b64 100644
--- a/golden/go/skiacorrectness/main.go
+++ b/golden/go/skiacorrectness/main.go
@@ -25,9 +25,6 @@ import (
// Command line flags.
var (
- // Get the default connection string suitable for production.
- defaultDbConnStr = db.GetConnectionString("readwrite", "", "", "")
-
graphiteServer = flag.String("graphite_server", "skia-monitoring:2003", "Where is Graphite metrics ingestion server running.")
port = flag.String("port", ":9000", "HTTP service address (e.g., ':9000')")
local = flag.Bool("local", false, "Running locally if true. As opposed to in production.")
@@ -35,8 +32,6 @@ var (
tileStoreDir = flag.String("tile_store_dir", "/tmp/tileStore", "What directory to look for tiles in.")
imageDir = flag.String("image_dir", "/tmp/imagedir", "What directory to store test and diff images in.")
gsBucketName = flag.String("gs_bucket", "chromium-skia-gm", "Name of the google storage bucket that holds uploaded images.")
- dbConnStr = flag.String("db_conn_string", defaultDbConnStr, "MySQL connection string for backend database. If 'local' is false the password in this string will be substituted via the metadata server.")
- sqlitePath = flag.String("sqlite_path", "./golden.db", "Filepath of the embedded SQLite database. Requires 'local' to be set to true and 'mysql_conn' to be empty to take effect.")
doOauth = flag.Bool("oauth", true, "Run through the OAuth 2.0 flow on startup, otherwise use a GCE service account.")
oauthCacheFile = flag.String("oauth_cache_file", "/home/perf/google_storage_token.data", "Path to the file where to cache cache the oauth credentials.")
)
@@ -214,6 +209,9 @@ func getOAuthClient(doOauth bool, cacheFilePath string) *http.Client {
}
func main() {
+ // Setup DB flags.
+ database.SetupFlags(db.PROD_DB_HOST, db.PROD_DB_PORT, database.USER_RW, db.PROD_DB_NAME)
+
// Global init to initialize
common.InitWithMetrics("skiacorrectness", *graphiteServer)
@@ -240,7 +238,11 @@ func main() {
// Get the expecations storage, the filediff storage and the tilestore.
diffStore := filediffstore.NewFileDiffStore(client, *imageDir, *gsBucketName, filediffstore.DEFAULT_GS_IMG_DIR_NAME, filediffstore.RECOMMENDED_WORKER_POOL_SIZE)
- vdb := database.NewVersionedDB(db.GetConfig(*dbConnStr, *sqlitePath, *local))
+ conf, err := database.ConfigFromFlagsAndMetadata(*local, db.MigrationSteps())
+ if err != nil {
+ glog.Fatal(err)
+ }
+ vdb := database.NewVersionedDB(conf)
expStore := expstorage.NewCachingExpectationStore(expstorage.NewSQLExpectationStore(vdb))
tileStore := filetilestore.NewFileTileStore(*tileStoreDir, "golden", -1)

Powered by Google App Engine
This is Rietveld 408576698