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

chore: fix all issues reported by the CI #2018

Merged
merged 10 commits into from
Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions cmd/clidoc/main.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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