From cd1ee3f3b876bb0f440c65f724f03df28b704944 Mon Sep 17 00:00:00 2001 From: Stuart Douglas Date: Thu, 15 Aug 2024 06:53:25 +1000 Subject: [PATCH] chore: clean up the WithJava API --- backend/controller/leases/lease_integration_test.go | 1 - integration/harness.go | 8 +++++--- java-runtime/java_integration_test.go | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/controller/leases/lease_integration_test.go b/backend/controller/leases/lease_integration_test.go index 0f68a9558f..64f2d7bba3 100644 --- a/backend/controller/leases/lease_integration_test.go +++ b/backend/controller/leases/lease_integration_test.go @@ -20,7 +20,6 @@ import ( func TestLease(t *testing.T) { in.Run(t, in.WithLanguages("go", "java"), - in.WithJava(), in.CopyModule("leases"), in.Build("leases"), // checks if leases work in a unit test environment diff --git a/integration/harness.go b/integration/harness.go index 79fb915aa6..c38181577a 100644 --- a/integration/harness.go +++ b/integration/harness.go @@ -9,6 +9,7 @@ import ( "fmt" "os" "path/filepath" + "slices" "sync" "syscall" "testing" @@ -78,8 +79,9 @@ func WithEnvar(key, value string) Option { } } -// WithJava is a Run* option that ensures the Java runtime is built. -func WithJava() Option { +// BuildJava is a Run* option that ensures the Java runtime is built. +// If the test languages contain java this is not necessary, as it is implied +func BuildJava() Option { return func(o *options) { o.requireJava = true } @@ -176,7 +178,7 @@ func run(t *testing.T, actionsOrOptions ...ActionOrOption) { Infof("Building ftl") err = ftlexec.Command(ctx, log.Debug, rootDir, "just", "build", "ftl").RunBuffered(ctx) assert.NoError(t, err) - if opts.requireJava { + if opts.requireJava || slices.Contains(opts.languages, "java") { err = ftlexec.Command(ctx, log.Debug, rootDir, "just", "build-java", "-DskipTests").RunBuffered(ctx) assert.NoError(t, err) } diff --git a/java-runtime/java_integration_test.go b/java-runtime/java_integration_test.go index 1b1b58d62f..ef7b415c92 100644 --- a/java-runtime/java_integration_test.go +++ b/java-runtime/java_integration_test.go @@ -22,7 +22,7 @@ func TestJavaToGoCall(t *testing.T) { StringField: "obj", BytesField: []byte{87, 2, 9}, BoolField: true, - TimeField: time.Now().Local(), + TimeField: time.Now().UTC(), ArrayField: []string{"foo", "bar"}, MapField: map[string]string{"gar": "har"}, } @@ -105,7 +105,6 @@ func TestJavaToGoCall(t *testing.T) { //tests = append(tests, PairedPrefixVerbTest("nilvalue", "optionalTestObjectOptionalFieldsVerb", ftl.None[any]())...) in.Run(t, - in.WithJava(), in.WithLanguages("java"), in.CopyModule("gomodule"), in.CopyModule("javamodule"),