Skip to content

Commit

Permalink
refactored grpc server initialization ans starting
Browse files Browse the repository at this point in the history
  • Loading branch information
janardhankrishna-sai committed Nov 4, 2024
1 parent d57fcd9 commit 5bec96e
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions xds/server_ext_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,12 @@ func (s) TestServingModeChanges(t *testing.T) {
}
},
}
server, err := xds.NewGRPCServer(grpc.Creds(insecure.NewCredentials()), modeChangeOpt, xds.BootstrapContentsForTesting(bootstrapContents))
if err != nil {
t.Fatalf("Failed to create an xDS enabled gRPC server: %v", err)
sopts := []grpc.ServerOption{grpc.Creds(insecure.NewCredentials()), modeChangeOpt, xds.BootstrapContentsForTesting(bootstrapContents)}
if stub.S, err = xds.NewGRPCServer(sopts...); err != nil {
t.Errorf("error in grpc server: %v", err)
}
defer server.Stop()

stub.S = server
stubserver.StartTestService(t, stub)
stubserver.StartTestService(t, stub, sopts...)
defer stub.S.Stop()

go func() {
if err := stub.S.Serve(lis); err != nil {
Expand Down Expand Up @@ -286,14 +284,12 @@ func (s) TestResourceNotFoundRDS(t *testing.T) {
}
},
}
server, err := xds.NewGRPCServer(grpc.Creds(insecure.NewCredentials()), modeChangeOpt, xds.BootstrapContentsForTesting(bootstrapContents))
if err != nil {
t.Fatalf("Failed to create an xDS enabled gRPC server: %v", err)
sopts := []grpc.ServerOption{grpc.Creds(insecure.NewCredentials()), modeChangeOpt, xds.BootstrapContentsForTesting(bootstrapContents)}
if stub.S, err = xds.NewGRPCServer(sopts...); err != nil {
t.Errorf("error in grpc server: %v", err)
}
defer server.Stop()

stub.S = server
stubserver.StartTestService(t, stub)
stubserver.StartTestService(t, stub, sopts...)
defer stub.S.Stop()

go func() {
if err := stub.S.Serve(lis); err != nil {
Expand Down

0 comments on commit 5bec96e

Please sign in to comment.