Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#24789] Add message for new prism users, in case of failures that might have worked on direct runner. #27886

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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