storage: Surface "already exists" errors.
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
sqlite3 "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
func TestMigrate(t *testing.T) {
|
||||
@@ -21,7 +22,15 @@ func TestMigrate(t *testing.T) {
|
||||
Level: logrus.DebugLevel,
|
||||
}
|
||||
|
||||
c := &conn{db, flavorSQLite3, logger}
|
||||
errCheck := func(err error) bool {
|
||||
sqlErr, ok := err.(sqlite3.Error)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return sqlErr.ExtendedCode == sqlite3.ErrConstraintUnique
|
||||
}
|
||||
|
||||
c := &conn{db, flavorSQLite3, logger, errCheck}
|
||||
for _, want := range []int{len(migrations), 0} {
|
||||
got, err := c.migrate()
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user