Skip to content

Commit

Permalink
Add message for new prism users.
Browse files Browse the repository at this point in the history
  • Loading branch information
lostluck committed Aug 7, 2023
1 parent 3b112e8 commit 4ba4755
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sdks/go/pkg/beam/testing/ptest/ptest.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package ptest
import (
"context"
"flag"
"fmt"
"os"
"testing"

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

Expand Down

0 comments on commit 4ba4755

Please sign in to comment.