-
Notifications
You must be signed in to change notification settings - Fork 498
[chore] : Bump the go group across 1 directory with 4 updates #371
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,24 @@ | ||
| module github.com/hashicorp/go-plugin | ||
|
|
||
| go 1.24 | ||
| go 1.24.0 | ||
|
|
||
| require ( | ||
| github.com/golang/protobuf v1.5.4 | ||
| github.com/hashicorp/go-hclog v1.6.3 | ||
| github.com/hashicorp/yamux v0.1.2 | ||
| github.com/jhump/protoreflect v1.17.0 | ||
| github.com/oklog/run v1.1.0 | ||
| google.golang.org/grpc v1.61.0 | ||
| google.golang.org/protobuf v1.36.6 | ||
| github.com/jhump/protoreflect v1.18.0 | ||
| github.com/oklog/run v1.2.0 | ||
| google.golang.org/grpc v1.66.2 | ||
| google.golang.org/protobuf v1.36.11 | ||
| ) | ||
|
|
||
| require ( | ||
| github.com/bufbuild/protocompile v0.14.1 // indirect | ||
| github.com/fatih/color v1.13.0 // indirect | ||
| github.com/jhump/protoreflect/v2 v2.0.0-beta.1 // indirect | ||
| github.com/mattn/go-colorable v0.1.12 // indirect | ||
| github.com/mattn/go-isatty v0.0.17 // indirect | ||
| golang.org/x/net v0.38.0 // indirect | ||
| golang.org/x/sys v0.31.0 // indirect | ||
| golang.org/x/text v0.23.0 // indirect | ||
| google.golang.org/genproto/googleapis/rpc v0.0.0-20231106174013-bbf56f31fb17 // indirect | ||
| google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,10 +10,12 @@ import ( | |
| "net" | ||
| "net/rpc" | ||
| "testing" | ||
| "time" | ||
|
|
||
| hclog "github.com/hashicorp/go-hclog" | ||
| "github.com/hashicorp/go-plugin/internal/grpcmux" | ||
| "google.golang.org/grpc" | ||
| "google.golang.org/grpc/connectivity" | ||
| "google.golang.org/grpc/credentials/insecure" | ||
| ) | ||
|
|
||
|
|
@@ -120,15 +122,26 @@ func TestGRPCConn(t testing.TB, register func(*grpc.Server)) (*grpc.ClientConn, | |
| go func() { _ = server.Serve(l) }() | ||
|
|
||
| // Connect to the server | ||
| conn, err := grpc.Dial( | ||
| conn, err := grpc.NewClient( | ||
| l.Addr().String(), | ||
| grpc.WithBlock(), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. grpc.WithBlock() is not supported as a parameter for grpc.NewClient |
||
| grpc.WithTransportCredentials(insecure.NewCredentials()), | ||
| ) | ||
| if err != nil { | ||
| t.Fatalf("err: %s", err) | ||
| } | ||
|
|
||
| // Wait for the connection to be established before closing the listener | ||
| ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) | ||
| defer cancel() | ||
| conn.Connect() | ||
|
|
||
| // Wait until connection reaches Ready state | ||
| for state := conn.GetState(); state != connectivity.Ready; state = conn.GetState() { | ||
| if !conn.WaitForStateChange(ctx, state) { | ||
| t.Fatalf("failed to establish connection, final state: %v", conn.GetState()) | ||
| } | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The NewClient has the property that it will stay idle unless a connection is explicitly established. conn.Connect() establishes this connection. A new logic for blocking was added for it because otherwise the listener was closing before the connection was completed. The above logic is inspired by the existing code present in grpc library for A better way will be to pass the listener as a parmeter in |
||
|
|
||
| // Connection successful, close the listener | ||
| _ = l.Close() | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
grpc.Dial is depreciated and it is recommended to use NewClient instead. Both the methods are pretty much similar based on the godocs, with only a minor difference described below.
NewClient requires
passthrough:///to be added in the address in order to let the custom dialer do its work. This is not required inDialorDialContextbecause the passthrough parameter is already defined inside those methods