Skip to content

Commit

Permalink
chore: don't build/start console for tests unless explicitly required (
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored Oct 31, 2024
1 parent e6c0b2f commit 9917c4a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
12 changes: 11 additions & 1 deletion Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ errtrace:
clean:
rm -rf build
rm -rf node_modules
rm -rf frontend/console/dist
rm -rf frontend/console/node_modules
find . -name '*.zip' -exec rm {} \;
mvn -f jvm-runtime/ftl-runtime clean

Expand All @@ -48,7 +50,15 @@ build-generate:

# Build command-line tools
build +tools: build-protos build-zips build-frontend
@just build-without-frontend $@

# Build command-line tools
# This does not have a dependency on the frontend
# But it will be included if it was already built
build-without-frontend +tools: build-protos build-zips
#!/bin/bash
mkdir -p frontend/console/dist
touch frontend/console/dist/.phoney
shopt -s extglob

export CGO_ENABLED=0
Expand Down Expand Up @@ -139,7 +149,7 @@ pnpm-install:
@for i in {1..3}; do mk frontend/**/node_modules : frontend/**/package.json -- "pnpm install --frozen-lockfile" && break || sleep 5; done

# Regenerate protos
build-protos: pnpm-install
build-protos:
@mk {{SCHEMA_OUT}} : internal/schema -- "just go2proto"
@mk {{PROTOS_OUT}} : {{PROTOS_IN}} -- "just build-protos-unconditionally"

Expand Down
19 changes: 17 additions & 2 deletions internal/integration/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ func WithLocalstack() Option {
}
}

// WithConsole is a Run* option that specifies tests should build and start the console
func WithConsole() Option {
return func(o *options) {
o.console = true
}
}

// WithTestDataDir sets the directory from which to look for test data.
//
// Defaults to "testdata/<language>" if not provided.
Expand Down Expand Up @@ -165,6 +172,7 @@ type options struct {
envars map[string]string
kube bool
localstack bool
console bool
}

// Run an integration test.
Expand Down Expand Up @@ -252,10 +260,14 @@ func run(t *testing.T, actionsOrOptions ...ActionOrOption) {
dumpKubePods(ctx, optional.Ptr(kubeClient), kubeNamespace)
}
assert.NoError(t, err)
} else {
Infof("Building ftl")
} else if opts.console {
Infof("Building ftl with console")
err = ftlexec.Command(ctx, log.Debug, rootDir, "just", "build", "ftl").RunBuffered(ctx)
assert.NoError(t, err)
} else {
Infof("Building ftl without console")
err = ftlexec.Command(ctx, log.Debug, rootDir, "just", "build-without-frontend", "ftl").RunBuffered(ctx)
assert.NoError(t, err)
}
if opts.requireJava || slices.Contains(opts.languages, "java") || slices.Contains(opts.languages, "kotlin") {
err = ftlexec.Command(ctx, log.Debug, rootDir, "just", "build-java", "-DskipTests", "-B").RunBuffered(ctx)
Expand Down Expand Up @@ -283,6 +295,9 @@ func run(t *testing.T, actionsOrOptions ...ActionOrOption) {
if opts.startController {
Infof("Starting ftl cluster")
args := []string{filepath.Join(binDir, "ftl"), "serve", "--recreate"}
if !opts.console {
args = append(args, "--no-console")
}
if opts.startProvisioner {
args = append(args, "--provisioners=1")

Expand Down

0 comments on commit 9917c4a

Please sign in to comment.