Skip to content

Commit

Permalink
test: resolve test migration issues
Browse files Browse the repository at this point in the history
  • Loading branch information
hperl authored and aeneasr committed Sep 7, 2022
1 parent 5e6c099 commit 63b7303
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 45 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test-resetdb: node_modules
docker rm -f hydra_test_database_cockroach || true
docker run --rm --name hydra_test_database_mysql --platform linux/amd64 -p 3444:3306 -e MYSQL_ROOT_PASSWORD=secret -d mysql:5.7
docker run --rm --name hydra_test_database_postgres -p 3445:5432 -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=postgres -d postgres:9.6
docker run --rm --name hydra_test_database_cockroach -p 3446:26257 -d cockroach:v21.2.11 start-single-node --insecure
docker run --rm --name hydra_test_database_cockroach -p 3446:26257 -d cockroachdb/cockroach:v21.2.11 start-single-node --insecure

# Build local docker images
.PHONY: docker
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ replace (

replace github.com/ory/fosite => github.com/ory/fosite v0.42.3-0.20220513181618-5f156bd07d5d

replace github.com/gobuffalo/pop/v6 => github.com/gobuffalo/pop/v6 v6.0.3-dev.5.0.20220524113609-012ea29c84cd
replace github.com/gobuffalo/pop/v6 => github.com/gobuffalo/pop/v6 v6.0.4-0.20220524160009-195240e4a669

replace github.com/ory/x => github.com/ory/x v0.0.403-0.20220524154508-625030c7b432
replace github.com/ory/x => github.com/ory/x v0.0.403

require (
github.com/ThalesIgnite/crypto11 v1.2.4
Expand Down
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,8 @@ github.com/gobuffalo/plush/v4 v4.1.11 h1:IOLBE07W0VkiraJf36x547l3q5Ek3osP9vHzN48
github.com/gobuffalo/plush/v4 v4.1.11/go.mod h1:9OOII9uAM5pZnhWu1OkQnboXJjaWMQ7kcTl3zNcxvTM=
github.com/gobuffalo/pop v4.8.2+incompatible h1:/nP7hiu5arwMWzHBUZY5BmEKq6XcdjnceNCTZGe7uO0=
github.com/gobuffalo/pop v4.8.2+incompatible/go.mod h1:DwBz3SD5SsHpTZiTubcsFWcVDpJWGsxjVjMPnkiThWg=
github.com/gobuffalo/pop/v6 v6.0.3-dev.5.0.20220524113609-012ea29c84cd h1:C6bdB1hfCEUHdPXUDiRV+gfcALbLsiEfUZam/ML9zv0=
github.com/gobuffalo/pop/v6 v6.0.3-dev.5.0.20220524113609-012ea29c84cd/go.mod h1:UJ3ESOX8rKr2leurHKaIFPK61MtUraFqUe+N6t4sftc=
github.com/gobuffalo/pop/v6 v6.0.4-0.20220524160009-195240e4a669 h1:IVk9uuVEVLRo1VrNsj/A6eBMDs3xdAdZNPUhJqFybck=
github.com/gobuffalo/pop/v6 v6.0.4-0.20220524160009-195240e4a669/go.mod h1:dFcrMNPOwk+sl1Oa0lOb/jGbmjv+JV+5CZjMWNYR3KI=
github.com/gobuffalo/release v1.0.35/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4=
github.com/gobuffalo/release v1.0.38/go.mod h1:VtHFAKs61vO3wboCec5xr9JPTjYyWYcvaM3lclkc4x4=
github.com/gobuffalo/shoulders v1.0.1/go.mod h1:V33CcVmaQ4gRUmHKwq1fiTXuf8Gp/qjQBUL5tHPmvbA=
Expand Down Expand Up @@ -1179,7 +1179,6 @@ github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.5/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs=
github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/looplab/fsm v0.1.0 h1:Qte7Zdn/5hBNbXzP7yxVU4OIFHWXBovyTT2LaBTyC20=
Expand Down Expand Up @@ -1422,8 +1421,8 @@ github.com/ory/jsonschema/v3 v3.0.7 h1:GQ9qfZDiJqs4l2d3p56dozCChvejQFZyLKGHYzDzO
github.com/ory/jsonschema/v3 v3.0.7/go.mod h1:g8c8YOtN4TrR2wYeMdT02GDmzJDI0fEW2nI26BECafY=
github.com/ory/viper v1.7.5 h1:+xVdq7SU3e1vNaCsk/ixsfxE4zylk1TJUiJrY647jUE=
github.com/ory/viper v1.7.5/go.mod h1:ypOuyJmEUb3oENywQZRgeAMwqgOyDqwboO1tj3DjTaM=
github.com/ory/x v0.0.403-0.20220524154508-625030c7b432 h1:17c2BUtHHFMtMLC6ygn1WeRKC1D5BSG7faCpy10dy8o=
github.com/ory/x v0.0.403-0.20220524154508-625030c7b432/go.mod h1:r2c9mjaNeETiOHGu7qn3hs+5vmM4+lfqqF7Mot6Nc98=
github.com/ory/x v0.0.403 h1:DLoi8NJxJd1gChJ+KxfuNwmkvN4KA9GV03ACMYk1+Ac=
github.com/ory/x v0.0.403/go.mod h1:9cSWY2P/Kb3CHk7hk8ewRX9KX8fqGpKCild2Rcbw/n4=
github.com/parnurzeal/gorequest v0.2.15/go.mod h1:3Kh2QUMJoqw3icWAecsyzkpY7UzRfDhbRdTjtNwNiUE=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
Expand Down
15 changes: 9 additions & 6 deletions persistence/sql/migratest/migration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/ory/hydra/internal"
"github.com/ory/x/contextx"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -58,10 +60,10 @@ func TestMigrations(t *testing.T) {
connections := make(map[string]*pop.Connection, 1)

if testing.Short() {
//reg := internal.NewMockedRegistry(t, &contextx.Default{})
//require.NoError(t, reg.Persister().MigrateUp(context.Background()))
//c := reg.Persister().Connection(context.Background())
//connections["sqlite"] = c
reg := internal.NewMockedRegistry(t, &contextx.Default{})
require.NoError(t, reg.Persister().MigrateUp(context.Background()))
c := reg.Persister().Connection(context.Background())
connections["sqlite"] = c
}

if !testing.Short() {
Expand All @@ -70,10 +72,10 @@ func TestMigrations(t *testing.T) {
connections["postgres"] = dockertest.ConnectToTestPostgreSQLPop(t)
},
func() {
//connections["mysql"] = dockertest.ConnectToTestMySQLPop(t)
connections["mysql"] = dockertest.ConnectToTestMySQLPop(t)
},
func() {
//connections["cockroach"] = dockertest.ConnectPop(t, internal.NewEmptyTestCRDBServer(t))
connections["cockroach"] = dockertest.ConnectPop(t, internal.NewEmptyTestCRDBServer(t))
},
})
}
Expand All @@ -97,6 +99,7 @@ func TestMigrations(t *testing.T) {
os.DirFS("../migrations"),
popx.NewMigrator(c, l, nil, 1*time.Minute),
popx.WithTestdata(t, os.DirFS("./testdata")))
//tm := popx.NewTestMigrator(t, c, os.DirFS("../migrations"), os.DirFS("./testdata"), l)
require.NoError(t, err)
require.NoError(t, tm.Up(ctx))

Expand Down
Loading

0 comments on commit 63b7303

Please sign in to comment.