diff options
-rw-r--r-- | server/store/store_test.go | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/server/store/store_test.go b/server/store/store_test.go index 281a614..afe6c03 100644 --- a/server/store/store_test.go +++ b/server/store/store_test.go @@ -44,8 +44,9 @@ func testStore(t *testing.T, db CertStorer) { defer db.Close() r := &CertRecord{ - KeyID: "a", - Expires: time.Now().UTC().Add(1 * time.Minute), + KeyID: "a", + CreatedAt: time.Now().UTC(), + Expires: time.Now().UTC().Add(1 * time.Minute), } if err := db.SetRecord(r); err != nil { t.Error(err) @@ -92,7 +93,17 @@ func TestMySQLStore(t *testing.T) { t.Skip("No MYSQL_TEST environment variable") } u, _ := user.Current() - db, err := NewSQLStore(map[string]string{"type": "mysql", "username": u.Username}) + sqlConfig := map[string]string{ + "type": "mysql", + "password": os.Getenv("MYSQL_TEST_PASS"), + "address": os.Getenv("MYSQL_TEST_HOST"), + } + if testUser, ok := os.LookupEnv("MYSQL_TEST_USER"); ok { + sqlConfig["username"] = testUser + } else { + sqlConfig["username"] = u.Username + } + db, err := NewSQLStore(sqlConfig) if err != nil { t.Error(err) } |