Skip to content
This repository was archived by the owner on Aug 17, 2025. It is now read-only.
Closed
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
1 change: 0 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ test-integration *test:
# Run integration test(s)
integration-tests *test:
#!/bin/bash
echo "$PATH"
retry 3 /bin/bash -c "go test -fullpath -count 1 -v -tags integration -run '^({{test}})$' -p 1 $(find . -type f -name '*_test.go' -print0 | xargs -0 grep -r -l {{test}} | xargs grep -l '//go:build integration' | xargs -I {} dirname './{}' | tr '\n' ' ')"

# Alias for infrastructure-tests
Expand Down
2 changes: 1 addition & 1 deletion backend/admin/testdata/go/dischema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/XSAM/otelsql v0.38.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/kong v1.10.0 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/types v0.19.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/admin/testdata/go/dischema/go.sum

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

2 changes: 1 addition & 1 deletion backend/admin/testdata/go/resetsub/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/types v0.19.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/admin/testdata/go/resetsub/go.sum

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

2 changes: 1 addition & 1 deletion backend/console/testdata/go/console/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/types v0.19.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/console/testdata/go/console/go.sum

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

2 changes: 1 addition & 1 deletion backend/controller/leases/testdata/go/leases/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replace github.com/block/ftl => ./../../../../../..

require (
github.com/alecthomas/assert/v2 v2.11.0
github.com/alecthomas/errors v0.7.0
github.com/alecthomas/errors v0.8.2
github.com/block/ftl v0.0.0-00010101000000-000000000000
golang.org/x/sync v0.13.0
)
Expand Down
4 changes: 2 additions & 2 deletions backend/controller/leases/testdata/go/leases/go.sum

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

2 changes: 1 addition & 1 deletion backend/controller/sql/testdata/go/database/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/XSAM/otelsql v0.38.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/kong v1.10.0 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/repr v0.4.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/controller/sql/testdata/go/database/go.sum

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

2 changes: 1 addition & 1 deletion backend/controller/sql/testdata/go/mysql/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
github.com/XSAM/otelsql v0.38.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/kong v1.10.0 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/repr v0.4.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/controller/sql/testdata/go/mysql/go.sum

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

2 changes: 1 addition & 1 deletion backend/cron/testdata/go/cron/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/types v0.19.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/cron/testdata/go/cron/go.sum

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

2 changes: 1 addition & 1 deletion backend/ingress/testdata/go/httpingress/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/types v0.19.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/ingress/testdata/go/httpingress/go.sum

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

30 changes: 16 additions & 14 deletions backend/provisioner/dev_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,24 @@ import (
"github.com/block/ftl/internal/dsn"
"github.com/block/ftl/internal/key"
"github.com/block/ftl/internal/log"
"github.com/block/ftl/internal/projectconfig"
"github.com/block/ftl/internal/provisioner/executor"
"github.com/block/ftl/internal/provisioner/state"
)

var redPandaBrokers = []string{"127.0.0.1:19092"}

// NewDevProvisioner creates a new provisioner that provisions resources locally when running FTL in dev mode
func NewDevProvisioner(postgresPort int, mysqlPort int, recreate bool) *InMemProvisioner {
func NewDevProvisioner(project projectconfig.Config, postgresPort int, mysqlPort int, recreate bool) *InMemProvisioner {
return NewEmbeddedProvisioner(map[schema.ResourceType]InMemResourceProvisionerFn{
schema.ResourceTypePostgres: provisionPostgres(postgresPort, recreate),
schema.ResourceTypeMysql: provisionMysql(mysqlPort, recreate),
schema.ResourceTypeTopic: provisionTopic(),
schema.ResourceTypePostgres: provisionPostgres(project, postgresPort, recreate),
schema.ResourceTypeMysql: provisionMysql(project, mysqlPort, recreate),
schema.ResourceTypeTopic: provisionTopic(project),
schema.ResourceTypeSubscription: provisionSubscription(),
}, map[schema.ResourceType]InMemResourceProvisionerFn{})
}
func provisionMysql(mysqlPort int, recreate bool) InMemResourceProvisionerFn {

func provisionMysql(project projectconfig.Config, mysqlPort int, recreate bool) InMemResourceProvisionerFn {
return func(ctx context.Context, changeset key.Changeset, deployment key.Deployment, res schema.Provisioned, module *schema.Module) (*schema.RuntimeElement, error) {
logger := log.FromContext(ctx).Deployment(deployment)

Expand All @@ -50,7 +52,7 @@ func provisionMysql(mysqlPort int, recreate bool) InMemResourceProvisionerFn {
}

// We assume that the DB hsas already been started when running in dev mode
mysqlDSN, err := dev.SetupMySQL(ctx, mysqlPort)
mysqlDSN, err := dev.SetupMySQL(ctx, project, mysqlPort)
if err != nil {
return nil, errors.Wrap(err, "failed to wait for mysql to be ready")
}
Expand Down Expand Up @@ -146,27 +148,27 @@ func establishMySQLDB(ctx context.Context, mysqlDSN string, dbName string, mysql
}, nil
}

func ProvisionPostgresForTest(ctx context.Context, realm, module, id string) (string, error) {
func ProvisionPostgresForTest(ctx context.Context, project projectconfig.Config, realm, module, id string) (string, error) {
node := &schema.Database{Name: id + "_test"}
event, err := provisionPostgres(15432, true)(ctx, key.NewChangesetKey(), key.NewDeploymentKey(realm, module), node, nil)
event, err := provisionPostgres(project, 15432, true)(ctx, key.NewChangesetKey(), key.NewDeploymentKey(realm, module), node, nil)
if err != nil {
return "", errors.WithStack(err)
}

return event.Element.(*schema.DatabaseRuntime).Connections.Write.(*schema.DSNDatabaseConnector).DSN, nil //nolint:forcetypeassert
}

func ProvisionMySQLForTest(ctx context.Context, realm, module, id string) (string, error) {
func ProvisionMySQLForTest(ctx context.Context, project projectconfig.Config, realm, module, id string) (string, error) {
node := &schema.Database{Name: id + "_test"}
event, err := provisionMysql(13306, true)(ctx, key.NewChangesetKey(), key.NewDeploymentKey(realm, module), node, nil)
event, err := provisionMysql(project, 13306, true)(ctx, key.NewChangesetKey(), key.NewDeploymentKey(realm, module), node, nil)
if err != nil {
return "", errors.WithStack(err)
}
return event.Element.(*schema.DatabaseRuntime).Connections.Write.(*schema.DSNDatabaseConnector).DSN, nil //nolint:forcetypeassert

}

func provisionPostgres(postgresPort int, alwaysRecreate bool) InMemResourceProvisionerFn {
func provisionPostgres(project projectconfig.Config, postgresPort int, alwaysRecreate bool) InMemResourceProvisionerFn {
return func(ctx context.Context, changeset key.Changeset, deployment key.Deployment, resource schema.Provisioned, module *schema.Module) (*schema.RuntimeElement, error) {
recreate := alwaysRecreate
logger := log.FromContext(ctx).Deployment(deployment)
Expand All @@ -180,7 +182,7 @@ func provisionPostgres(postgresPort int, alwaysRecreate bool) InMemResourceProvi

// We assume that the DB has already been started when running in dev mode
postgresDSN := dsn.PostgresDSN("ftl", dsn.Port(postgresPort))
err := dev.SetupPostgres(ctx, optional.None[string](), postgresPort, recreate)
err := dev.SetupPostgres(ctx, project, optional.None[string](), postgresPort, recreate)
if err != nil {
return nil, errors.Wrap(err, "failed to wait for postgres to be ready")
}
Expand Down Expand Up @@ -265,9 +267,9 @@ func provisionPostgres(postgresPort int, alwaysRecreate bool) InMemResourceProvi

}

func provisionTopic() InMemResourceProvisionerFn {
func provisionTopic(project projectconfig.Config) InMemResourceProvisionerFn {
return func(ctx context.Context, changeset key.Changeset, deployment key.Deployment, res schema.Provisioned, module *schema.Module) (*schema.RuntimeElement, error) {
if err := dev.SetUpRedPanda(ctx); err != nil {
if err := dev.SetUpRedPanda(ctx, project); err != nil {
return nil, errors.Wrap(err, "could not set up redpanda")
}

Expand Down
2 changes: 1 addition & 1 deletion backend/provisioner/scaling/testdata/go/echo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/types v0.19.0 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/provisioner/scaling/testdata/go/echo/go.sum

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

2 changes: 1 addition & 1 deletion backend/provisioner/scaling/testdata/go/types/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ replace github.com/block/ftl => ./../../../../../..
require github.com/block/ftl v0.0.0-00010101000000-000000000000

require (
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/types v0.19.0 // indirect
github.com/deckarep/golang-set/v2 v2.8.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions backend/provisioner/scaling/testdata/go/types/go.sum

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

2 changes: 1 addition & 1 deletion backend/provisioner/testdata/go/echo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
github.com/XSAM/otelsql v0.38.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alecthomas/concurrency v0.0.2 // indirect
github.com/alecthomas/errors v0.7.0 // indirect
github.com/alecthomas/errors v0.8.2 // indirect
github.com/alecthomas/kong v1.10.0 // indirect
github.com/alecthomas/participle/v2 v2.1.4 // indirect
github.com/alecthomas/types v0.19.0 // indirect
Expand Down
Loading
Loading