You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by jr...@apache.org on 2023/06/07 20:37:14 UTC

[beam] branch master updated: Make use of prism in periodic tests not cross compile. (#27054)

This is an automated email from the ASF dual-hosted git repository.

jrmccluskey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 95ecb31452f Make use of prism in periodic tests not cross compile. (#27054)
95ecb31452f is described below

commit 95ecb31452fe60fb54a7335076a932ed2d3ad3a0
Author: Robert Burke <lo...@users.noreply.github.com>
AuthorDate: Wed Jun 7 13:37:07 2023 -0700

    Make use of prism in periodic tests not cross compile. (#27054)
    
    Co-authored-by: lostluck <13...@users.noreply.github.com>
---
 sdks/go/pkg/beam/transforms/periodic/periodic.go      | 2 +-
 sdks/go/pkg/beam/transforms/periodic/periodic_test.go | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/sdks/go/pkg/beam/transforms/periodic/periodic.go b/sdks/go/pkg/beam/transforms/periodic/periodic.go
index f8752dc2c93..5a7b4d0cf53 100644
--- a/sdks/go/pkg/beam/transforms/periodic/periodic.go
+++ b/sdks/go/pkg/beam/transforms/periodic/periodic.go
@@ -100,7 +100,7 @@ func (fn *sequenceGenDoFn) ProcessElement(ctx context.Context, we *sdf.ManualWat
 	for currentOutputTimestamp.Before(currentTime) {
 		if rt.TryClaim(currentOutputIndex) {
 			emit(mtime.FromTime(currentOutputTimestamp), currentOutputIndex)
-			currentOutputIndex += 1
+			currentOutputIndex++
 			currentOutputTimestamp = mtime.Time(sd.Start).ToTime().Add(sd.Interval * time.Duration(currentOutputIndex))
 			currentTime = time.Now()
 			we.UpdateWatermark(currentOutputTimestamp)
diff --git a/sdks/go/pkg/beam/transforms/periodic/periodic_test.go b/sdks/go/pkg/beam/transforms/periodic/periodic_test.go
index 7553e1f818a..a34edf8d07b 100644
--- a/sdks/go/pkg/beam/transforms/periodic/periodic_test.go
+++ b/sdks/go/pkg/beam/transforms/periodic/periodic_test.go
@@ -21,12 +21,16 @@ import (
 	"time"
 
 	"github.com/apache/beam/sdks/v2/go/pkg/beam"
+	"github.com/apache/beam/sdks/v2/go/pkg/beam/options/jobopts"
 	_ "github.com/apache/beam/sdks/v2/go/pkg/beam/runners/prism"
 	"github.com/apache/beam/sdks/v2/go/pkg/beam/testing/passert"
 	"github.com/apache/beam/sdks/v2/go/pkg/beam/testing/ptest"
 )
 
 func TestMain(m *testing.M) {
+	// Since we force loopback with prism, avoid cross-compilation.
+	f, _ := os.CreateTemp("", "dummy")
+	*jobopts.WorkerBinary = f.Name()
 	os.Exit(ptest.MainRetWithDefault(m, "prism"))
 }