Skip to content

Commit cc60a79

Browse files
committed
Fixing a few minor issues
1 parent 95dca11 commit cc60a79

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

database/database_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// Copyright 2020 The Moov Authors
22
// Use of this source code is governed by an Apache License
33
// license that can be found in the LICENSE file.
4-
package database
4+
package database_test
55

66
import (
77
"errors"
88
"testing"
9+
10+
"github.com/moov-io/base/database"
911
)
1012

1113
func TestUniqueViolation(t *testing.T) {
1214
err := errors.New(`problem upserting depository="282f6ffcd9ba5b029afbf2b739ee826e22d9df3b", userId="f25f48968da47ef1adb5b6531a1c2197295678ce": Error 1062: Duplicate entry '282f6ffcd9ba5b029afbf2b739ee826e22d9df3b' for key 'PRIMARY'`)
13-
if !UniqueViolation(err) {
15+
if !database.UniqueViolation(err) {
1416
t.Error("should have matched unique violation")
1517
}
1618
}

database/model_config_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
// Copyright 2020 The Moov Authors
22
// Use of this source code is governed by an Apache License
33
// license that can be found in the LICENSE file.
4-
package database
4+
package database_test
55

66
import (
77
"bytes"
88
"encoding/json"
99
"testing"
1010

11+
"github.com/moov-io/base/database"
1112
"github.com/stretchr/testify/require"
1213
)
1314

1415
func TestMySQLConfig(t *testing.T) {
15-
cfg := &MySQLConfig{
16+
cfg := &database.MySQLConfig{
1617
Address: "tcp(localhost:3306)",
1718
User: "app",
1819
Password: "secret",
19-
Connections: ConnectionsConfig{
20+
Connections: database.ConnectionsConfig{
2021
MaxOpen: 100,
2122
},
2223
}

database/mysql.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ func (my *mysql) Connect(ctx context.Context) (*sql.DB, error) {
101101
db.SetMaxOpenConns(maxActiveMySQLConnections)
102102

103103
// Check out DB is up and working
104-
// if err := db.Ping(); err != nil {
105-
// return nil, err
106-
// }
104+
if err := db.Ping(); err != nil {
105+
return nil, err
106+
}
107107

108108
// Setup metrics after the database is setup
109109
go func(db *sql.DB) {

0 commit comments

Comments
 (0)