Skip to content

Commit

Permalink
chore: fix issues reported by the CI (#2018)
Browse files Browse the repository at this point in the history
  • Loading branch information
zepatrik committed Dec 3, 2021
1 parent 947ad62 commit dd460db
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 27 deletions.
4 changes: 0 additions & 4 deletions cmd/clidoc/main.go
Expand Up @@ -269,7 +269,3 @@ func validateAllMessages(path string) error {

return nil
}

type importerFunc func(path string) (*types.Package, error)

func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) }
2 changes: 1 addition & 1 deletion internal/driver.go
Expand Up @@ -80,7 +80,7 @@ func NewRegistryDefaultWithDSN(t *testing.T, dsn string) (*config.Config, *drive
require.NoError(t, err)
reg.Config(context.Background()).MustSet("dev", true)
require.NoError(t, reg.Init(context.Background(), driver.SkipNetworkInit))
require.NoError(t, reg.Persister().NetworkMigrateUp(context.Background()))
require.NoError(t, reg.Persister().MigrateUp(context.Background())) // always migrate up

actual, err := reg.Persister().DetermineNetwork(context.Background())
require.NoError(t, err)
Expand Down
1 change: 0 additions & 1 deletion persistence/reference.go
Expand Up @@ -48,7 +48,6 @@ type Persister interface {
MigrationStatus(c context.Context) (popx.MigrationStatuses, error)
MigrateDown(c context.Context, steps int) error
MigrateUp(c context.Context) error
NetworkMigrateUp(c context.Context) error
Migrator() *popx.Migrator
GetConnection(ctx context.Context) *pop.Connection
Transaction(ctx context.Context, callback func(ctx context.Context, connection *pop.Connection) error) error
Expand Down
15 changes: 4 additions & 11 deletions persistence/sql/persister.go
Expand Up @@ -5,6 +5,8 @@ import (
"embed"
"fmt"

"github.com/ory/x/fsx"

"github.com/ory/kratos/corp"

"github.com/gobuffalo/pop/v5"
Expand Down Expand Up @@ -49,10 +51,11 @@ type (
)

func NewPersister(ctx context.Context, r persisterDependencies, c *pop.Connection) (*Persister, error) {
m, err := popx.NewMigrationBox(migrations, popx.NewMigrator(c, r.Logger(), r.Tracer(ctx), 0))
m, err := popx.NewMigrationBox(fsx.Merge(migrations, networkx.Migrations), popx.NewMigrator(c, r.Logger(), r.Tracer(ctx), 0))
if err != nil {
return nil, err
}
m.DumpMigrations = false

return &Persister{
c: c, mb: m, r: r, isSQLite: c.Dialect.Name() == "sqlite3",
Expand Down Expand Up @@ -102,17 +105,7 @@ func (p *Persister) MigrateDown(ctx context.Context, steps int) error {
return p.mb.Down(ctx, steps)
}

func (p *Persister) NetworkMigrateUp(ctx context.Context) error {
// nolint
return p.p.MigrateUp(ctx)
}

func (p *Persister) MigrateUp(ctx context.Context) error {
// nolint
if err := p.p.MigrateUp(ctx); err != nil {
return err
}

return p.mb.Up(ctx)
}

Expand Down
3 changes: 1 addition & 2 deletions selfservice/flow/settings/strategy_helper.go
@@ -1,7 +1,6 @@
package settings

import (
"fmt"
"net/http"
"runtime/debug"
"time"
Expand Down Expand Up @@ -70,7 +69,7 @@ func PrepareUpdate(d interface {
}
d.Logger().
WithField("package", pkgName).
WithField("stack_trace", fmt.Sprintf("%s", debug.Stack())).
WithField("stack_trace", string(debug.Stack())).
WithField("expected_request_id", payload.GetFlowID()).
WithField("actual_request_id", f.ID).
Debug("Flow ID from continuity manager does not match Flow ID from request.")
Expand Down
Expand Up @@ -82,17 +82,21 @@ describe('Basic email profile with succeeding login flows', () => {
cy.proxy('express')
cy.useConfigProfile('email')

cy.shortLoginLifespan()
cy.browserReturnUrlOry()
})

beforeEach(() => {
cy.clearAllCookies()
cy.visit(express.login + '?return_to=https://www.ory.sh/')
})

it('should redirect to return_to when retrying expired flow', () => {
cy.shortLoginLifespan()
cy.wait(500)

cy.visit(express.login + '?return_to=https://www.ory.sh/')

cy.longLoginLifespan()

cy.get(appPrefix('express') + 'input[name="password_identifier"]').type(
email.toUpperCase()
)
Expand Down
6 changes: 2 additions & 4 deletions test/e2e/cypress/support/commands.ts
Expand Up @@ -30,11 +30,9 @@ const mergeFields = (form, fields) => {

const updateConfigFile = (cb: (arg: any) => any) => {
cy.readFile(configFile).then((contents) => {
let config = YAML.parse(contents)
config = cb(config)
cy.writeFile(configFile, YAML.stringify(config))
cy.writeFile(configFile, YAML.stringify(cb(YAML.parse(contents))))
cy.wait(200)
})
cy.wait(200)
}

Cypress.Commands.add('useConfigProfile', (profile: string) => {
Expand Down
1 change: 0 additions & 1 deletion test/e2e/proxy/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion text/id_test.go
Expand Up @@ -23,7 +23,8 @@ func TestIDs(t *testing.T) {
assert.Equal(t, 1060001, int(InfoSelfServiceRecoverySuccessful))
assert.Equal(t, 1060002, int(InfoSelfServiceRecoveryEmailSent))

assert.Equal(t, 1070000, int(InfoSelfServiceVerification))
assert.Equal(t, 1070000, int(InfoNodeLabel))
assert.Equal(t, 1080000, int(InfoSelfServiceVerification))

assert.Equal(t, 4000000, int(ErrorValidation))
assert.Equal(t, 4000001, int(ErrorValidationGeneric))
Expand Down

0 comments on commit dd460db

Please sign in to comment.