Skip to content

Commit 4ba4755

Browse files
committed
Add message for new prism users.
1 parent 3b112e8 commit 4ba4755

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

sdks/go/pkg/beam/testing/ptest/ptest.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ package ptest
1919
import (
2020
"context"
2121
"flag"
22+
"fmt"
2223
"os"
2324
"testing"
2425

@@ -95,7 +96,17 @@ func MainCalled() bool {
9596
// Run runs a pipeline for testing. The semantics of the pipeline is expected
9697
// to be verified through passert.
9798
func Run(p *beam.Pipeline) error {
98-
_, err := beam.Run(context.Background(), getRunner(), p)
99+
r := getRunner()
100+
_, err := beam.Run(context.Background(), r, p)
101+
// Until a few versions from now (say, v2.56),
102+
// if there's an error, and
103+
// the runner is prism, and it was the set default runner, but not a manually specificed runner via the flag
104+
// augment the error with instructions to switch back to the direct runner.
105+
if err != nil && r == "prism" && r == defaultRunnerOverride && r != *Runner {
106+
err = fmt.Errorf("%w\nerror may be due to Apache Beam Go's migration from the direct runner to the prism runner."+
107+
" While the failure(s) should be fixed, you can continue to use the direct runner with this TestMain override:"+
108+
" `func TestMain(m *testing.M) { ptest.MainWithDefault(m, \"direct\") }`", err)
109+
}
99110
return err
100111
}
101112

0 commit comments

Comments
 (0)