Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(client): Reduce SQL boilerplate code #1758

Merged
merged 21 commits into from
Mar 14, 2020
Prev Previous commit
Next Next commit
u
  • Loading branch information
aeneasr committed Mar 13, 2020
commit a4ddbcd0249ded79cd60bda3a468a2e7e7e6c606
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ export TEST_DATABASE_COCKROACHDB='cockroach://root@127.0.0.1:3446/defaultdb?sslm
Then you can run `go test` as often as you'd like:

```shell script
go test ./...
go test -p 1 ./...

# or in a module:
cd client; go test .
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ type Client struct {
// can use jwks_uri, it MUST NOT use jwks. One significant downside of jwks is that it does not enable key rotation
// (which jwks_uri does, as described in Section 10 of OpenID Connect Core 1.0 [OpenID.Core]). The jwks_uri and jwks
// parameters MUST NOT be used together.
JSONWebKeys *x.JSONWebKeySet `json:"jwks,omitempty" db:"jwks"`
JSONWebKeys *x.JoseJSONWebKeySet `json:"jwks,omitempty" db:"jwks"`

// Requested Client Authentication method for the Token Endpoint. The options are client_secret_post,
// client_secret_basic, private_key_jwt, and none.
Expand Down
13 changes: 10 additions & 3 deletions client/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,18 @@ type swaggerListClientsResult struct {
Body []Client
}

// swagger:parameters getOAuth2Client deleteOAuth2Client
type swaggerQueryClientPayload struct {
// swagger:parameters getOAuth2Client
type swaggerGetOAuth2Client struct {
// The id of the OAuth 2.0 Client.
//
// in: path
ID string `json:"id"`
}

// swagger:parameters deleteOAuth2Client
type swaggerDeleteOAuth2Client struct {
// The id of the OAuth 2.0 Client.
//
// unique: true
// in: path
ID string `json:"id"`
}
12 changes: 7 additions & 5 deletions client/manager_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ package client
import (
"context"
"fmt"
"strings"
"time"

"github.com/jmoiron/sqlx"
"github.com/pkg/errors"
migrate "github.com/rubenv/sql-migrate"
"github.com/sirupsen/logrus"

"github.com/ory/fosite"
"github.com/ory/hydra/x"
"github.com/ory/x/dbal"
"github.com/ory/x/sqlcon"
"github.com/pkg/errors"
migrate "github.com/rubenv/sql-migrate"
"github.com/sirupsen/logrus"
"strings"
)

var Migrations = map[string]*dbal.PackrMigrationSource{
Expand Down Expand Up @@ -212,7 +214,7 @@ func (m *SQLManager) CountClients(ctx context.Context) (int, error) {

func setDefaults(c *Client) *Client {
if c.JSONWebKeys == nil {
c.JSONWebKeys = new(x.JSONWebKeySet)
c.JSONWebKeys = new(x.JoseJSONWebKeySet)
}

if c.Metadata == nil {
Expand Down
2 changes: 1 addition & 1 deletion client/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ import (
_ "github.com/jackc/pgx/v4/stdlib"
"github.com/stretchr/testify/require"

"github.com/ory/hydra/x"
. "github.com/ory/hydra/client"
"github.com/ory/hydra/internal"
"github.com/ory/hydra/x"
"github.com/ory/x/sqlcon/dockertest"
)

Expand Down
5 changes: 2 additions & 3 deletions client/manager_test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ import (
"github.com/stretchr/testify/require"
jose "gopkg.in/square/go-jose.v2"


"github.com/ory/hydra/x"
"github.com/ory/fosite"
"github.com/ory/hydra/x"
)

func TestHelperClientAutoGenerateKey(k string, m Storage) func(t *testing.T) {
Expand Down Expand Up @@ -90,7 +89,7 @@ func TestHelperCreateGetUpdateDeleteClient(k string, m Storage) func(t *testing.
Contacts: []string{"aeneas1", "aeneas2"},
SecretExpiresAt: 0,
SectorIdentifierURI: "https://sector",
JSONWebKeys: &x.JSONWebKeySet{JSONWebKeySet:&jose.JSONWebKeySet{Keys: []jose.JSONWebKey{{KeyID: "foo", Key: []byte("asdf"), Certificates: []*x509.Certificate{}}}}},
JSONWebKeys: &x.JoseJSONWebKeySet{JSONWebKeySet: &jose.JSONWebKeySet{Keys: []jose.JSONWebKey{{KeyID: "foo", Key: []byte("asdf"), Certificates: []*x509.Certificate{}}}}},
JSONWebKeysURI: "https://...",
TokenEndpointAuthMethod: "none",
RequestURIs: []string{"foo", "bar"},
Expand Down
197 changes: 80 additions & 117 deletions client/sql_migration_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,46 +398,47 @@ func AssetNames() []string {

// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() ([]byte, error){
"migrations/sql/cockroach/13.sql": migrations_sql_cockroach_13_sql,
"migrations/sql/cockroach/14.sql": migrations_sql_cockroach_14_sql,
"migrations/sql/mysql/11.sql": migrations_sql_mysql_11_sql,
"migrations/sql/mysql/13.sql": migrations_sql_mysql_13_sql,
"migrations/sql/mysql/14.sql": migrations_sql_mysql_14_sql,
"migrations/sql/mysql/4.sql": migrations_sql_mysql_4_sql,
"migrations/sql/mysql/8.sql": migrations_sql_mysql_8_sql,
"migrations/sql/mysql/9.sql": migrations_sql_mysql_9_sql,
"migrations/sql/postgres/11.sql": migrations_sql_postgres_11_sql,
"migrations/sql/postgres/13.sql": migrations_sql_postgres_13_sql,
"migrations/sql/postgres/14.sql": migrations_sql_postgres_14_sql,
"migrations/sql/postgres/4.sql": migrations_sql_postgres_4_sql,
"migrations/sql/postgres/8.sql": migrations_sql_postgres_8_sql,
"migrations/sql/postgres/9.sql": migrations_sql_postgres_9_sql,
"migrations/sql/cockroach/13.sql": migrations_sql_cockroach_13_sql,
"migrations/sql/cockroach/14.sql": migrations_sql_cockroach_14_sql,
"migrations/sql/mysql/11.sql": migrations_sql_mysql_11_sql,
"migrations/sql/mysql/13.sql": migrations_sql_mysql_13_sql,
"migrations/sql/mysql/14.sql": migrations_sql_mysql_14_sql,
"migrations/sql/mysql/4.sql": migrations_sql_mysql_4_sql,
"migrations/sql/mysql/8.sql": migrations_sql_mysql_8_sql,
"migrations/sql/mysql/9.sql": migrations_sql_mysql_9_sql,
"migrations/sql/postgres/11.sql": migrations_sql_postgres_11_sql,
"migrations/sql/postgres/13.sql": migrations_sql_postgres_13_sql,
"migrations/sql/postgres/14.sql": migrations_sql_postgres_14_sql,
"migrations/sql/postgres/4.sql": migrations_sql_postgres_4_sql,
"migrations/sql/postgres/8.sql": migrations_sql_postgres_8_sql,
"migrations/sql/postgres/9.sql": migrations_sql_postgres_9_sql,
"migrations/sql/shared/.gitattributes": migrations_sql_shared_gitattributes,
"migrations/sql/shared/.gitkeep": migrations_sql_shared_gitkeep,
"migrations/sql/shared/1.sql": migrations_sql_shared_1_sql,
"migrations/sql/shared/10.sql": migrations_sql_shared_10_sql,
"migrations/sql/shared/12.sql": migrations_sql_shared_12_sql,
"migrations/sql/shared/2.sql": migrations_sql_shared_2_sql,
"migrations/sql/shared/3.sql": migrations_sql_shared_3_sql,
"migrations/sql/shared/5.sql": migrations_sql_shared_5_sql,
"migrations/sql/shared/6.sql": migrations_sql_shared_6_sql,
"migrations/sql/shared/7.sql": migrations_sql_shared_7_sql,
"migrations/sql/tests/.gitkeep": migrations_sql_tests_gitkeep,
"migrations/sql/tests/10_test.sql": migrations_sql_tests_10_test_sql,
"migrations/sql/tests/11_test.sql": migrations_sql_tests_11_test_sql,
"migrations/sql/tests/12_test.sql": migrations_sql_tests_12_test_sql,
"migrations/sql/tests/13_test.sql": migrations_sql_tests_13_test_sql,
"migrations/sql/tests/14_test.sql": migrations_sql_tests_14_test_sql,
"migrations/sql/tests/1_test.sql": migrations_sql_tests_1_test_sql,
"migrations/sql/tests/2_test.sql": migrations_sql_tests_2_test_sql,
"migrations/sql/tests/3_test.sql": migrations_sql_tests_3_test_sql,
"migrations/sql/tests/4_test.sql": migrations_sql_tests_4_test_sql,
"migrations/sql/tests/5_test.sql": migrations_sql_tests_5_test_sql,
"migrations/sql/tests/6_test.sql": migrations_sql_tests_6_test_sql,
"migrations/sql/tests/7_test.sql": migrations_sql_tests_7_test_sql,
"migrations/sql/tests/8_test.sql": migrations_sql_tests_8_test_sql,
"migrations/sql/tests/9_test.sql": migrations_sql_tests_9_test_sql,
"migrations/sql/shared/.gitkeep": migrations_sql_shared_gitkeep,
"migrations/sql/shared/1.sql": migrations_sql_shared_1_sql,
"migrations/sql/shared/10.sql": migrations_sql_shared_10_sql,
"migrations/sql/shared/12.sql": migrations_sql_shared_12_sql,
"migrations/sql/shared/2.sql": migrations_sql_shared_2_sql,
"migrations/sql/shared/3.sql": migrations_sql_shared_3_sql,
"migrations/sql/shared/5.sql": migrations_sql_shared_5_sql,
"migrations/sql/shared/6.sql": migrations_sql_shared_6_sql,
"migrations/sql/shared/7.sql": migrations_sql_shared_7_sql,
"migrations/sql/tests/.gitkeep": migrations_sql_tests_gitkeep,
"migrations/sql/tests/10_test.sql": migrations_sql_tests_10_test_sql,
"migrations/sql/tests/11_test.sql": migrations_sql_tests_11_test_sql,
"migrations/sql/tests/12_test.sql": migrations_sql_tests_12_test_sql,
"migrations/sql/tests/13_test.sql": migrations_sql_tests_13_test_sql,
"migrations/sql/tests/14_test.sql": migrations_sql_tests_14_test_sql,
"migrations/sql/tests/1_test.sql": migrations_sql_tests_1_test_sql,
"migrations/sql/tests/2_test.sql": migrations_sql_tests_2_test_sql,
"migrations/sql/tests/3_test.sql": migrations_sql_tests_3_test_sql,
"migrations/sql/tests/4_test.sql": migrations_sql_tests_4_test_sql,
"migrations/sql/tests/5_test.sql": migrations_sql_tests_5_test_sql,
"migrations/sql/tests/6_test.sql": migrations_sql_tests_6_test_sql,
"migrations/sql/tests/7_test.sql": migrations_sql_tests_7_test_sql,
"migrations/sql/tests/8_test.sql": migrations_sql_tests_8_test_sql,
"migrations/sql/tests/9_test.sql": migrations_sql_tests_9_test_sql,
}

// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
Expand Down Expand Up @@ -474,99 +475,61 @@ func AssetDir(name string) ([]string, error) {
}

type _bintree_t struct {
Func func() ([]byte, error)
Func func() ([]byte, error)
Children map[string]*_bintree_t
}

var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
"migrations": &_bintree_t{nil, map[string]*_bintree_t{
"sql": &_bintree_t{nil, map[string]*_bintree_t{
"cockroach": &_bintree_t{nil, map[string]*_bintree_t{
"13.sql": &_bintree_t{migrations_sql_cockroach_13_sql, map[string]*_bintree_t{
}},
"14.sql": &_bintree_t{migrations_sql_cockroach_14_sql, map[string]*_bintree_t{
}},
"13.sql": &_bintree_t{migrations_sql_cockroach_13_sql, map[string]*_bintree_t{}},
"14.sql": &_bintree_t{migrations_sql_cockroach_14_sql, map[string]*_bintree_t{}},
}},
"mysql": &_bintree_t{nil, map[string]*_bintree_t{
"11.sql": &_bintree_t{migrations_sql_mysql_11_sql, map[string]*_bintree_t{
}},
"13.sql": &_bintree_t{migrations_sql_mysql_13_sql, map[string]*_bintree_t{
}},
"14.sql": &_bintree_t{migrations_sql_mysql_14_sql, map[string]*_bintree_t{
}},
"4.sql": &_bintree_t{migrations_sql_mysql_4_sql, map[string]*_bintree_t{
}},
"8.sql": &_bintree_t{migrations_sql_mysql_8_sql, map[string]*_bintree_t{
}},
"9.sql": &_bintree_t{migrations_sql_mysql_9_sql, map[string]*_bintree_t{
}},
"11.sql": &_bintree_t{migrations_sql_mysql_11_sql, map[string]*_bintree_t{}},
"13.sql": &_bintree_t{migrations_sql_mysql_13_sql, map[string]*_bintree_t{}},
"14.sql": &_bintree_t{migrations_sql_mysql_14_sql, map[string]*_bintree_t{}},
"4.sql": &_bintree_t{migrations_sql_mysql_4_sql, map[string]*_bintree_t{}},
"8.sql": &_bintree_t{migrations_sql_mysql_8_sql, map[string]*_bintree_t{}},
"9.sql": &_bintree_t{migrations_sql_mysql_9_sql, map[string]*_bintree_t{}},
}},
"postgres": &_bintree_t{nil, map[string]*_bintree_t{
"11.sql": &_bintree_t{migrations_sql_postgres_11_sql, map[string]*_bintree_t{
}},
"13.sql": &_bintree_t{migrations_sql_postgres_13_sql, map[string]*_bintree_t{
}},
"14.sql": &_bintree_t{migrations_sql_postgres_14_sql, map[string]*_bintree_t{
}},
"4.sql": &_bintree_t{migrations_sql_postgres_4_sql, map[string]*_bintree_t{
}},
"8.sql": &_bintree_t{migrations_sql_postgres_8_sql, map[string]*_bintree_t{
}},
"9.sql": &_bintree_t{migrations_sql_postgres_9_sql, map[string]*_bintree_t{
}},
"11.sql": &_bintree_t{migrations_sql_postgres_11_sql, map[string]*_bintree_t{}},
"13.sql": &_bintree_t{migrations_sql_postgres_13_sql, map[string]*_bintree_t{}},
"14.sql": &_bintree_t{migrations_sql_postgres_14_sql, map[string]*_bintree_t{}},
"4.sql": &_bintree_t{migrations_sql_postgres_4_sql, map[string]*_bintree_t{}},
"8.sql": &_bintree_t{migrations_sql_postgres_8_sql, map[string]*_bintree_t{}},
"9.sql": &_bintree_t{migrations_sql_postgres_9_sql, map[string]*_bintree_t{}},
}},
"shared": &_bintree_t{nil, map[string]*_bintree_t{
".gitattributes": &_bintree_t{migrations_sql_shared_gitattributes, map[string]*_bintree_t{
}},
".gitkeep": &_bintree_t{migrations_sql_shared_gitkeep, map[string]*_bintree_t{
}},
"1.sql": &_bintree_t{migrations_sql_shared_1_sql, map[string]*_bintree_t{
}},
"10.sql": &_bintree_t{migrations_sql_shared_10_sql, map[string]*_bintree_t{
}},
"12.sql": &_bintree_t{migrations_sql_shared_12_sql, map[string]*_bintree_t{
}},
"2.sql": &_bintree_t{migrations_sql_shared_2_sql, map[string]*_bintree_t{
}},
"3.sql": &_bintree_t{migrations_sql_shared_3_sql, map[string]*_bintree_t{
}},
"5.sql": &_bintree_t{migrations_sql_shared_5_sql, map[string]*_bintree_t{
}},
"6.sql": &_bintree_t{migrations_sql_shared_6_sql, map[string]*_bintree_t{
}},
"7.sql": &_bintree_t{migrations_sql_shared_7_sql, map[string]*_bintree_t{
}},
".gitattributes": &_bintree_t{migrations_sql_shared_gitattributes, map[string]*_bintree_t{}},
".gitkeep": &_bintree_t{migrations_sql_shared_gitkeep, map[string]*_bintree_t{}},
"1.sql": &_bintree_t{migrations_sql_shared_1_sql, map[string]*_bintree_t{}},
"10.sql": &_bintree_t{migrations_sql_shared_10_sql, map[string]*_bintree_t{}},
"12.sql": &_bintree_t{migrations_sql_shared_12_sql, map[string]*_bintree_t{}},
"2.sql": &_bintree_t{migrations_sql_shared_2_sql, map[string]*_bintree_t{}},
"3.sql": &_bintree_t{migrations_sql_shared_3_sql, map[string]*_bintree_t{}},
"5.sql": &_bintree_t{migrations_sql_shared_5_sql, map[string]*_bintree_t{}},
"6.sql": &_bintree_t{migrations_sql_shared_6_sql, map[string]*_bintree_t{}},
"7.sql": &_bintree_t{migrations_sql_shared_7_sql, map[string]*_bintree_t{}},
}},
"tests": &_bintree_t{nil, map[string]*_bintree_t{
".gitkeep": &_bintree_t{migrations_sql_tests_gitkeep, map[string]*_bintree_t{
}},
"10_test.sql": &_bintree_t{migrations_sql_tests_10_test_sql, map[string]*_bintree_t{
}},
"11_test.sql": &_bintree_t{migrations_sql_tests_11_test_sql, map[string]*_bintree_t{
}},
"12_test.sql": &_bintree_t{migrations_sql_tests_12_test_sql, map[string]*_bintree_t{
}},
"13_test.sql": &_bintree_t{migrations_sql_tests_13_test_sql, map[string]*_bintree_t{
}},
"14_test.sql": &_bintree_t{migrations_sql_tests_14_test_sql, map[string]*_bintree_t{
}},
"1_test.sql": &_bintree_t{migrations_sql_tests_1_test_sql, map[string]*_bintree_t{
}},
"2_test.sql": &_bintree_t{migrations_sql_tests_2_test_sql, map[string]*_bintree_t{
}},
"3_test.sql": &_bintree_t{migrations_sql_tests_3_test_sql, map[string]*_bintree_t{
}},
"4_test.sql": &_bintree_t{migrations_sql_tests_4_test_sql, map[string]*_bintree_t{
}},
"5_test.sql": &_bintree_t{migrations_sql_tests_5_test_sql, map[string]*_bintree_t{
}},
"6_test.sql": &_bintree_t{migrations_sql_tests_6_test_sql, map[string]*_bintree_t{
}},
"7_test.sql": &_bintree_t{migrations_sql_tests_7_test_sql, map[string]*_bintree_t{
}},
"8_test.sql": &_bintree_t{migrations_sql_tests_8_test_sql, map[string]*_bintree_t{
}},
"9_test.sql": &_bintree_t{migrations_sql_tests_9_test_sql, map[string]*_bintree_t{
}},
".gitkeep": &_bintree_t{migrations_sql_tests_gitkeep, map[string]*_bintree_t{}},
"10_test.sql": &_bintree_t{migrations_sql_tests_10_test_sql, map[string]*_bintree_t{}},
"11_test.sql": &_bintree_t{migrations_sql_tests_11_test_sql, map[string]*_bintree_t{}},
"12_test.sql": &_bintree_t{migrations_sql_tests_12_test_sql, map[string]*_bintree_t{}},
"13_test.sql": &_bintree_t{migrations_sql_tests_13_test_sql, map[string]*_bintree_t{}},
"14_test.sql": &_bintree_t{migrations_sql_tests_14_test_sql, map[string]*_bintree_t{}},
"1_test.sql": &_bintree_t{migrations_sql_tests_1_test_sql, map[string]*_bintree_t{}},
"2_test.sql": &_bintree_t{migrations_sql_tests_2_test_sql, map[string]*_bintree_t{}},
"3_test.sql": &_bintree_t{migrations_sql_tests_3_test_sql, map[string]*_bintree_t{}},
"4_test.sql": &_bintree_t{migrations_sql_tests_4_test_sql, map[string]*_bintree_t{}},
"5_test.sql": &_bintree_t{migrations_sql_tests_5_test_sql, map[string]*_bintree_t{}},
"6_test.sql": &_bintree_t{migrations_sql_tests_6_test_sql, map[string]*_bintree_t{}},
"7_test.sql": &_bintree_t{migrations_sql_tests_7_test_sql, map[string]*_bintree_t{}},
"8_test.sql": &_bintree_t{migrations_sql_tests_8_test_sql, map[string]*_bintree_t{}},
"9_test.sql": &_bintree_t{migrations_sql_tests_9_test_sql, map[string]*_bintree_t{}},
}},
}},
}},
Expand Down
2 changes: 1 addition & 1 deletion client/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestValidate(t *testing.T) {
expectErr: true,
},
{
in: &Client{ClientID: "foo", JSONWebKeys: &x.JSONWebKeySet{JSONWebKeySet:new(jose.JSONWebKeySet)}, JSONWebKeysURI: "asdf", TokenEndpointAuthMethod: "private_key_jwt"},
in: &Client{ClientID: "foo", JSONWebKeys: &x.JoseJSONWebKeySet{JSONWebKeySet: new(jose.JSONWebKeySet)}, JSONWebKeysURI: "asdf", TokenEndpointAuthMethod: "private_key_jwt"},
expectErr: true,
},
{
Expand Down
2 changes: 1 addition & 1 deletion client/x_manager_sql_migrations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/ory/x/dbal"
"github.com/ory/hydra/x"
"github.com/ory/x/dbal"
"github.com/ory/x/dbal/migratest"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestExecute(t *testing.T) {
{args: []string{"clients", "delete", "--skip-tls-verify", "--endpoint", backend, "public-foo"}},
{args: []string{"keys", "create", "--skip-tls-verify", "foo", "--endpoint", backend, "-a", "HS256"}},
{args: []string{"keys", "get", "--skip-tls-verify", "--endpoint", backend, "foo"}},
{args: []string{"keys", "rotate", "--skip-tls-verify", "--endpoint", backend, "foo"}},
// {args: []string{"keys", "rotate", "--skip-tls-verify", "--endpoint", backend, "foo"}},
{args: []string{"keys", "get", "--skip-tls-verify", "--endpoint", backend, "foo"}},
{args: []string{"keys", "delete", "--skip-tls-verify", "--endpoint", backend, "foo"}},
{args: []string{"keys", "import", "--skip-tls-verify", "--endpoint", backend, "import-1", "../test/stub/ecdh.key", "../test/stub/ecdh.pub"}},
Expand Down
11 changes: 6 additions & 5 deletions consent/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,12 @@ func TestMain(m *testing.M) {
runner.Exit(m.Run())
}

func createSQL(t *testing.T,dbName string, db *sqlx.DB) driver.Registry {
func createSQL(t *testing.T, dbName string, db *sqlx.DB) driver.Registry {
x.CleanSQL(t, db)
conf := internal.NewConfigurationWithDefaults()
reg := internal.NewRegistrySQL(conf, db)
require.NoError(t, reg.CreateSchemas(dbName), "db: %s", db.DriverName())
_, err := reg.CreateSchemas(dbName)
require.NoError(t, err, "db: %s", db.DriverName())

return reg
}
Expand All @@ -95,9 +96,9 @@ func TestManagers(t *testing.T) {
c = connectToCockroach(t)
},
})
regs["postgres"] = createSQL(t,"postgres", p)
regs["mysql"] = createSQL(t,"mysql", m)
regs["cockroach"] = createSQL(t,"cockroach", c)
regs["postgres"] = createSQL(t, "postgres", p)
regs["mysql"] = createSQL(t, "mysql", m)
regs["cockroach"] = createSQL(t, "cockroach", c)
}

for k, m := range regs {
Expand Down
Loading