Skip to content

Commit

Permalink
Fixing linting issues
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Antonio Osorio <[email protected]>
  • Loading branch information
JAORMX committed Nov 17, 2022
1 parent 1c3aa9b commit 99ff06c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 9 additions & 8 deletions storage/testdb/testdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ var (
trillianCRDBSchema = testonly.RelativeToPackage("../crdb/schema/storage.sql")
)

// TestDBDriverName is the name of a database driver.
type TestDBDriverName string
// DriverName is the name of a database driver.
type DriverName string

const (
// DriverMySQL is the identifier for the MySQL storage driver.
DriverMySQL TestDBDriverName = "mysql"
DriverMySQL DriverName = "mysql"
// DriverCockroachDB is the identifier for the CockroachDB storage driver.
DriverCockroachDB TestDBDriverName = "cockroachdb"
DriverCockroachDB DriverName = "cockroachdb"
)

var driverMapping = map[TestDBDriverName]storageDriverInfo{
var driverMapping = map[DriverName]storageDriverInfo{
DriverMySQL: {
sqlDriverName: "mysql",
schema: trillianMySQLSchema,
Expand Down Expand Up @@ -152,7 +152,7 @@ func CockroachDBAvailable() bool {
return dbAvailable(DriverCockroachDB)
}

func dbAvailable(driver TestDBDriverName) bool {
func dbAvailable(driver DriverName) bool {
driverName := driverMapping[driver].sqlDriverName
uri := driverMapping[driver].uriFunc()
db, err := sql.Open(driverName, uri)
Expand Down Expand Up @@ -188,7 +188,7 @@ func SetFDLimit(uLimit uint64) error {
// using the DB, the caller should not continue to use the returned DB after
// calling this function as it may, for example, delete the underlying
// instance.
func newEmptyDB(ctx context.Context, driver TestDBDriverName) (*sql.DB, func(context.Context), error) {
func newEmptyDB(ctx context.Context, driver DriverName) (*sql.DB, func(context.Context), error) {
if err := SetFDLimit(2048); err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -231,7 +231,7 @@ func newEmptyDB(ctx context.Context, driver TestDBDriverName) (*sql.DB, func(con
// NewTrillianDB creates an empty database with the Trillian schema. The database name is randomly
// generated.
// NewTrillianDB is equivalent to Default().NewTrillianDB(ctx).
func NewTrillianDB(ctx context.Context, driver TestDBDriverName) (*sql.DB, func(context.Context), error) {
func NewTrillianDB(ctx context.Context, driver DriverName) (*sql.DB, func(context.Context), error) {
db, done, err := newEmptyDB(ctx, driver)
if err != nil {
return nil, nil, err
Expand Down Expand Up @@ -278,6 +278,7 @@ func SkipIfNoMySQL(t *testing.T) {
t.Logf("Test MySQL available at %q", mysqlURI())
}

// SkipIfNoCockroachDB is a test helper that skips tests that require a local CockroachDB.
func SkipIfNoCockroachDB(t *testing.T) {
t.Helper()
if !CockroachDBAvailable() {
Expand Down
2 changes: 1 addition & 1 deletion testonly/integration/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// NewRegistryForTests returns an extension.Registry for integration tests.
// Callers should call the returned cleanup function when they're finished
// with the registry and its contents.
func NewRegistryForTests(ctx context.Context, driver testdb.TestDBDriverName) (extension.Registry, func(context.Context), error) {
func NewRegistryForTests(ctx context.Context, driver testdb.DriverName) (extension.Registry, func(context.Context), error) {
db, done, err := testdb.NewTrillianDB(ctx, driver)
if err != nil {
return extension.Registry{}, nil, err
Expand Down

0 comments on commit 99ff06c

Please sign in to comment.