Skip to content

Commit

Permalink
reverting rb.InitialState from cc.UpdateState
Browse files Browse the repository at this point in the history
  • Loading branch information
janardhankrishna-sai committed Dec 13, 2024
1 parent 6e64672 commit 0cb8e39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion resolver_balancer_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (s) TestResolverBalancerInteraction(t *testing.T) {
rb := manual.NewBuilderWithScheme(name)
rb.BuildCallback = func(_ resolver.Target, cc resolver.ClientConn, _ resolver.BuildOptions) {
sc := cc.ParseServiceConfig(`{"loadBalancingConfig": [{"` + name + `":{}}]}`)
rb.InitialState(resolver.State{
cc.UpdateState(resolver.State{
Addresses: []resolver.Address{{Addr: "test"}},
ServiceConfig: sc,
})
Expand Down
12 changes: 4 additions & 8 deletions test/creds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,6 @@ func (s) TestCredsHandshakeAuthority(t *testing.T) {
if err != nil {
t.Fatal(err)
}
defer lis.Close()

cred := &authorityCheckCreds{}
s := grpc.NewServer()
Expand All @@ -437,17 +436,15 @@ func (s) TestCredsHandshakeAuthority(t *testing.T) {

r := manual.NewBuilderWithScheme("whatever")

r.InitialState(resolver.State{
Addresses: []resolver.Address{{Addr: lis.Addr().String()}},
})

cc, err := grpc.NewClient(r.Scheme()+":///"+testAuthority, grpc.WithTransportCredentials(cred), grpc.WithResolvers(r))
if err != nil {
t.Fatalf("grpc.NewClient(%q) = %v", lis.Addr().String(), err)
}
cc.Connect()
defer cc.Close()

r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String()}}})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
testutils.AwaitState(ctx, t, cc, connectivity.Ready)
Expand All @@ -467,20 +464,19 @@ func (s) TestCredsHandshakeServerNameAuthority(t *testing.T) {
t.Fatal(err)
}
cred := &authorityCheckCreds{}
defer lis.Close()

s := grpc.NewServer()
go s.Serve(lis)
defer s.Stop()

r := manual.NewBuilderWithScheme("whatever")
r.InitialState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String(), ServerName: testServerName}}})

cc, err := grpc.NewClient(r.Scheme()+":///"+testAuthority, grpc.WithTransportCredentials(cred), grpc.WithResolvers(r))
if err != nil {
t.Fatalf("grpc.NewClient(%q) = %v", lis.Addr().String(), err)
}
cc.Connect()
defer cc.Close()
r.UpdateState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String(), ServerName: testServerName}}})

ctx, cancel := context.WithTimeout(context.Background(), defaultTestTimeout)
defer cancel()
Expand Down

0 comments on commit 0cb8e39

Please sign in to comment.