mirror of https://github.com/grpc/grpc-go.git
xds: pass options by value to helper routines which setup the management server in tests (#5833)
This commit is contained in:
parent
638141fbb9
commit
aba03e1ab1
|
|
@ -104,18 +104,16 @@ type ManagementServerOptions struct {
|
|||
// resource snapshot held by the management server, as required by the test
|
||||
// logic. When the test is done, it should call the Stop() method to cleanup
|
||||
// resources allocated by the management server.
|
||||
func StartManagementServer(opts *ManagementServerOptions) (*ManagementServer, error) {
|
||||
func StartManagementServer(opts ManagementServerOptions) (*ManagementServer, error) {
|
||||
// Create a snapshot cache. The first parameter to NewSnapshotCache()
|
||||
// controls whether the server should wait for all resources to be
|
||||
// explicitly named in the request before responding to any of them.
|
||||
wait := opts == nil || !opts.AllowResourceSubset
|
||||
wait := !opts.AllowResourceSubset
|
||||
cache := v3cache.NewSnapshotCache(wait, v3cache.IDHash{}, serverLogger{})
|
||||
logger.Infof("Created new snapshot cache...")
|
||||
|
||||
var lis net.Listener
|
||||
if opts != nil && opts.Listener != nil {
|
||||
lis = opts.Listener
|
||||
} else {
|
||||
lis := opts.Listener
|
||||
if lis == nil {
|
||||
var err error
|
||||
lis, err = net.Listen("tcp", "localhost:0")
|
||||
if err != nil {
|
||||
|
|
@ -126,14 +124,11 @@ func StartManagementServer(opts *ManagementServerOptions) (*ManagementServer, er
|
|||
// Cancelling the context passed to the server is the only way of stopping it
|
||||
// at the end of the test.
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
callbacks := v3server.CallbackFuncs{}
|
||||
if opts != nil {
|
||||
callbacks = v3server.CallbackFuncs{
|
||||
StreamOpenFunc: opts.OnStreamOpen,
|
||||
StreamClosedFunc: opts.OnStreamClosed,
|
||||
StreamRequestFunc: opts.OnStreamRequest,
|
||||
StreamResponseFunc: opts.OnStreamResponse,
|
||||
}
|
||||
callbacks := v3server.CallbackFuncs{
|
||||
StreamOpenFunc: opts.OnStreamOpen,
|
||||
StreamClosedFunc: opts.OnStreamClosed,
|
||||
StreamRequestFunc: opts.OnStreamRequest,
|
||||
StreamResponseFunc: opts.OnStreamResponse,
|
||||
}
|
||||
|
||||
// Create an xDS management server and register the ADS implementation
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import (
|
|||
// - bootstrap contents to be used by the client
|
||||
// - xDS resolver builder to be used by the client
|
||||
// - a cleanup function to be invoked at the end of the test
|
||||
func SetupManagementServer(t *testing.T, opts *ManagementServerOptions) (*ManagementServer, string, []byte, resolver.Builder, func()) {
|
||||
func SetupManagementServer(t *testing.T, opts ManagementServerOptions) (*ManagementServer, string, []byte, resolver.Builder, func()) {
|
||||
t.Helper()
|
||||
|
||||
// Spin up an xDS management server on a local port.
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func (s) TestClientResourceVersionAfterStreamRestart(t *testing.T) {
|
|||
|
||||
// Map from stream id to a map of resource type to resource version.
|
||||
ackVersionsMap := make(map[int64]map[string]string)
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, &e2e.ManagementServerOptions{
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{
|
||||
Listener: lis,
|
||||
OnStreamRequest: func(id int64, req *v3discoverypb.DiscoveryRequest) error {
|
||||
// Return early under the following circumstances:
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func (s) TestClientSideAffinitySanityCheck(t *testing.T) {
|
|||
return func() { envconfig.XDSRingHash = old }
|
||||
}()()
|
||||
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
port, cleanup2 := startTestService(t, nil)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ func (s) TestClientSideFederation(t *testing.T) {
|
|||
defer func() { envconfig.XDSFederation = oldXDSFederation }()
|
||||
|
||||
// Start a management server as the default authority.
|
||||
serverDefaultAuth, err := e2e.StartManagementServer(nil)
|
||||
serverDefaultAuth, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ func (s) TestClientSideFederation(t *testing.T) {
|
|||
|
||||
// Start another management server as the other authority.
|
||||
const nonDefaultAuth = "non-default-auth"
|
||||
serverAnotherAuth, err := e2e.StartManagementServer(nil)
|
||||
serverAnotherAuth, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ func startTestService(t *testing.T, server *stubserver.StubServer) (uint32, func
|
|||
}
|
||||
|
||||
func (s) TestClientSideXDS(t *testing.T) {
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
port, cleanup2 := startTestService(t, nil)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ import (
|
|||
// Detection balancer. This test verifies that an RPC is able to proceed
|
||||
// normally with this configuration.
|
||||
func (s) TestOutlierDetection_NoopConfig(t *testing.T) {
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
port, cleanup2 := startTestService(t, nil)
|
||||
|
|
@ -166,7 +166,7 @@ func checkRoundRobinRPCs(ctx context.Context, client testpb.TestServiceClient, a
|
|||
// the unhealthy upstream is ejected, RPC's should regularly round robin across
|
||||
// all three upstreams.
|
||||
func (s) TestOutlierDetectionWithOutlier(t *testing.T) {
|
||||
managementServer, nodeID, _, r, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, _, r, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Working backend 1.
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ func (s) TestClientSideRetry(t *testing.T) {
|
|||
},
|
||||
}
|
||||
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
port, cleanup2 := startTestService(t, ss)
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ func testRLSinxDS(t *testing.T, lbPolicy e2e.LoadBalancingPolicy) {
|
|||
// Set up all components and configuration necessary - management server,
|
||||
// xDS resolver, fake RLS Server, and xDS configuration which specifies an
|
||||
// RLS Balancer that communicates to this set up fake RLS Server.
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
port, cleanup2 := startTestService(t, nil)
|
||||
defer cleanup2()
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ func (s) TestUnmarshalListener_WithUpdateValidatorFunc(t *testing.T) {
|
|||
missingIdentityProviderInstance = "missing-identity-provider-instance"
|
||||
missingRootProviderInstance = "missing-root-provider-instance"
|
||||
)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
lis, cleanup2 := setupGRPCServer(t, bootstrapContents)
|
||||
|
|
@ -324,7 +324,7 @@ func (s) TestUnmarshalCluster_WithUpdateValidatorFunc(t *testing.T) {
|
|||
// SetupManagementServer() sets up a bootstrap file with certificate
|
||||
// provider instance names: `e2e.ServerSideCertProviderInstance` and
|
||||
// `e2e.ClientSideCertProviderInstance`.
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, _, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
port, cleanup2 := startTestService(t, nil)
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ func hostPortFromListener(lis net.Listener) (string, uint32, error) {
|
|||
// the client and the server. This results in both of them using the
|
||||
// configured fallback credentials (which is insecure creds in this case).
|
||||
func (s) TestServerSideXDS_Fallback(t *testing.T) {
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
lis, cleanup2 := setupGRPCServer(t, bootstrapContents)
|
||||
|
|
@ -207,7 +207,7 @@ func (s) TestServerSideXDS_FileWatcherCerts(t *testing.T) {
|
|||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
lis, cleanup2 := setupGRPCServer(t, bootstrapContents)
|
||||
|
|
@ -277,7 +277,7 @@ func (s) TestServerSideXDS_FileWatcherCerts(t *testing.T) {
|
|||
// configuration pointing to the use of the file_watcher plugin and we verify
|
||||
// that the same client is now able to successfully make an RPC.
|
||||
func (s) TestServerSideXDS_SecurityConfigChange(t *testing.T) {
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
lis, cleanup2 := setupGRPCServer(t, bootstrapContents)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ func (s) TestServerSideXDS_RouteConfiguration(t *testing.T) {
|
|||
defer func() {
|
||||
envconfig.XDSRBAC = oldRBAC
|
||||
}()
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
lis, cleanup2 := setupGRPCServer(t, bootstrapContents)
|
||||
|
|
@ -605,7 +605,7 @@ func (s) TestRBACHTTPFilter(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
func() {
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
lis, cleanup2 := setupGRPCServer(t, bootstrapContents)
|
||||
|
|
@ -790,7 +790,7 @@ func (s) TestRBACToggledOn_WithBadRouteConfiguration(t *testing.T) {
|
|||
envconfig.XDSRBAC = oldRBAC
|
||||
}()
|
||||
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
lis, cleanup2 := setupGRPCServer(t, bootstrapContents)
|
||||
|
|
@ -847,7 +847,7 @@ func (s) TestRBACToggledOff_WithBadRouteConfiguration(t *testing.T) {
|
|||
envconfig.XDSRBAC = oldRBAC
|
||||
}()
|
||||
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, resolver, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
lis, cleanup2 := setupGRPCServer(t, bootstrapContents)
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import (
|
|||
// change callback is not invoked and client connections to the server are not
|
||||
// recycled.
|
||||
func (s) TestServerSideXDS_RedundantUpdateSuppression(t *testing.T) {
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
creds, err := xdscreds.NewServerCredentials(xdscreds.ServerOptions{FallbackCreds: insecure.NewCredentials()})
|
||||
|
|
@ -163,7 +163,7 @@ func (s) TestServerSideXDS_RedundantUpdateSuppression(t *testing.T) {
|
|||
// xDS enabled gRPC servers. It verifies that appropriate mode changes happen in
|
||||
// the server, and also verifies behavior of clientConns under these modes.
|
||||
func (s) TestServerSideXDS_ServingModeChanges(t *testing.T) {
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Configure xDS credentials to be used on the server-side.
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ func commonSetup(ctx context.Context, t *testing.T) (xdsclient.XDSClient, *e2e.M
|
|||
|
||||
// Spin up a xDS management server on a local port.
|
||||
nodeID := uuid.New().String()
|
||||
fs, err := e2e.StartManagementServer(nil)
|
||||
fs, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ func clientEndpointsResource(nodeID, edsServiceName string, localities []localit
|
|||
// 4. Replace the backend. Test verifies that all RPCs reach the new backend.
|
||||
func (s) TestEDS_OneLocality(t *testing.T) {
|
||||
// Spin up a management server to receive xDS resources from.
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
// Start backend servers which provide an implementation of the TestService.
|
||||
|
|
@ -280,7 +280,7 @@ func (s) TestEDS_OneLocality(t *testing.T) {
|
|||
// weighted roundrobined across them.
|
||||
func (s) TestEDS_MultipleLocalities(t *testing.T) {
|
||||
// Spin up a management server to receive xDS resources from.
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
// Start backend servers which provide an implementation of the TestService.
|
||||
|
|
@ -403,7 +403,7 @@ func (s) TestEDS_MultipleLocalities(t *testing.T) {
|
|||
// traffic is routed only to backends deemed capable of receiving traffic.
|
||||
func (s) TestEDS_EndpointsHealth(t *testing.T) {
|
||||
// Spin up a management server to receive xDS resources from.
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
// Start backend servers which provide an implementation of the TestService.
|
||||
|
|
@ -483,7 +483,7 @@ func (s) TestEDS_EndpointsHealth(t *testing.T) {
|
|||
// removed" error.
|
||||
func (s) TestEDS_EmptyUpdate(t *testing.T) {
|
||||
// Spin up a management server to receive xDS resources from.
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, nil)
|
||||
managementServer, nodeID, bootstrapContents, _, cleanup1 := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup1()
|
||||
|
||||
// Start backend servers which provide an implementation of the TestService.
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ func (*testService) FullDuplexCall(stream testpb.TestService_FullDuplexCallServe
|
|||
func clientSetup(t *testing.T) (*e2e.ManagementServer, string, uint32, func()) {
|
||||
// Spin up a xDS management server on a local port.
|
||||
nodeID := uuid.New().String()
|
||||
fs, err := e2e.StartManagementServer(nil)
|
||||
fs, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ type controlPlane struct {
|
|||
|
||||
func newControlPlane() (*controlPlane, error) {
|
||||
// Spin up an xDS management server on a local port.
|
||||
server, err := e2e.StartManagementServer(nil)
|
||||
server, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,14 +77,14 @@ func setupForAuthorityTests(ctx context.Context, t *testing.T, idleTimeout time.
|
|||
lisNonDefault := testutils.NewListenerWrapper(t, nil)
|
||||
|
||||
// Start a management server to act as the default authority.
|
||||
defaultAuthorityServer, err := e2e.StartManagementServer(&e2e.ManagementServerOptions{Listener: lisDefault})
|
||||
defaultAuthorityServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{Listener: lisDefault})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { defaultAuthorityServer.Stop() })
|
||||
|
||||
// Start a management server to act as the non-default authority.
|
||||
nonDefaultAuthorityServer, err := e2e.StartManagementServer(&e2e.ManagementServerOptions{Listener: lisNonDefault})
|
||||
nonDefaultAuthorityServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{Listener: lisNonDefault})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ func (s) TestCDSWatch(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -274,7 +274,7 @@ func (s) TestCDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -359,7 +359,7 @@ func (s) TestCDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
|
|||
// all watch callbacks.
|
||||
func (s) TestCDSWatch_ThreeWatchesForDifferentResourceNames(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -440,7 +440,7 @@ func (s) TestCDSWatch_ResourceCaching(t *testing.T) {
|
|||
firstAckReceived := grpcsync.NewEvent()
|
||||
secondRequestReceived := grpcsync.NewEvent()
|
||||
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, &e2e.ManagementServerOptions{
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{
|
||||
OnStreamRequest: func(id int64, req *v3discoverypb.DiscoveryRequest) error {
|
||||
// The first request has an empty version string.
|
||||
if !firstRequestReceived && req.GetVersionInfo() == "" {
|
||||
|
|
@ -571,7 +571,7 @@ func (s) TestCDSWatch_ExpiryTimerFiresBeforeResponse(t *testing.T) {
|
|||
// invocation with error) does not take place.
|
||||
func (s) TestCDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, err := e2e.StartManagementServer(nil)
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
@ -644,7 +644,7 @@ func (s) TestCDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
|
|||
// invocation of the watch callback associated with the deleted resource.
|
||||
func (s) TesCDSWatch_ResourceRemoved(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -753,7 +753,7 @@ func (s) TesCDSWatch_ResourceRemoved(t *testing.T) {
|
|||
// propagated to the watcher.
|
||||
func (s) TestCDSWatch_NACKError(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -802,7 +802,7 @@ func (s) TestCDSWatch_NACKError(t *testing.T) {
|
|||
// invalid resource receive an error.
|
||||
func (s) TestCDSWatch_PartialValid(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ func (s) TestEDSWatch(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -322,7 +322,7 @@ func (s) TestEDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -408,7 +408,7 @@ func (s) TestEDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
|
|||
// The test is run with both old and new style names.
|
||||
func (s) TestEDSWatch_ThreeWatchesForDifferentResourceNames(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -490,7 +490,7 @@ func (s) TestEDSWatch_ResourceCaching(t *testing.T) {
|
|||
firstAckReceived := grpcsync.NewEvent()
|
||||
secondRequestReceived := grpcsync.NewEvent()
|
||||
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, &e2e.ManagementServerOptions{
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{
|
||||
OnStreamRequest: func(id int64, req *v3discoverypb.DiscoveryRequest) error {
|
||||
// The first request has an empty version string.
|
||||
if !firstRequestReceived && req.GetVersionInfo() == "" {
|
||||
|
|
@ -628,7 +628,7 @@ func (s) TestEDSWatch_ExpiryTimerFiresBeforeResponse(t *testing.T) {
|
|||
// invocation with error) does not take place.
|
||||
func (s) TestEDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, err := e2e.StartManagementServer(nil)
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
@ -700,7 +700,7 @@ func (s) TestEDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
|
|||
// propagated to the watcher.
|
||||
func (s) TestEDSWatch_NACKError(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -749,7 +749,7 @@ func (s) TestEDSWatch_NACKError(t *testing.T) {
|
|||
// invalid resource receive an error.
|
||||
func (s) TestEDSWatch_PartialValid(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
|
|||
|
|
@ -47,14 +47,14 @@ func setupForFederationWatchersTest(t *testing.T) (*e2e.ManagementServer, string
|
|||
overrideFedEnvVar(t)
|
||||
|
||||
// Start a management server as the default authority.
|
||||
serverDefaultAuthority, err := e2e.StartManagementServer(nil)
|
||||
serverDefaultAuthority, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
t.Cleanup(serverDefaultAuthority.Stop)
|
||||
|
||||
// Start another management server as the other authority.
|
||||
serverNonDefaultAuthority, err := e2e.StartManagementServer(nil)
|
||||
serverNonDefaultAuthority, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ func (s) TestLDSWatch(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -327,7 +327,7 @@ func (s) TestLDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -413,7 +413,7 @@ func (s) TestLDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
|
|||
// The test is run with both old and new style names.
|
||||
func (s) TestLDSWatch_ThreeWatchesForDifferentResourceNames(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -489,7 +489,7 @@ func (s) TestLDSWatch_ResourceCaching(t *testing.T) {
|
|||
firstAckReceived := grpcsync.NewEvent()
|
||||
secondRequestReceived := grpcsync.NewEvent()
|
||||
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, &e2e.ManagementServerOptions{
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{
|
||||
OnStreamRequest: func(id int64, req *v3discoverypb.DiscoveryRequest) error {
|
||||
// The first request has an empty version string.
|
||||
if !firstRequestReceived && req.GetVersionInfo() == "" {
|
||||
|
|
@ -620,7 +620,7 @@ func (s) TestLDSWatch_ExpiryTimerFiresBeforeResponse(t *testing.T) {
|
|||
// invocation with error) does not take place.
|
||||
func (s) TestLDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, err := e2e.StartManagementServer(nil)
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
@ -694,7 +694,7 @@ func (s) TestLDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
|
|||
// The test is run with both old and new style names.
|
||||
func (s) TestLDSWatch_ResourceRemoved(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -802,7 +802,7 @@ func (s) TestLDSWatch_ResourceRemoved(t *testing.T) {
|
|||
// propagated to the watcher.
|
||||
func (s) TestLDSWatch_NACKError(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -851,7 +851,7 @@ func (s) TestLDSWatch_NACKError(t *testing.T) {
|
|||
// invalid resource receive an error.
|
||||
func (s) TestLDSWatch_PartialValid(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func (s) TestWatchCallAnotherWatch(t *testing.T) {
|
|||
|
||||
// Start an xDS management server and set the option to allow it to respond
|
||||
// to requests which only specify a subset of the configured resources.
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, &e2e.ManagementServerOptions{AllowResourceSubset: true})
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{AllowResourceSubset: true})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ func (s) TestRDSWatch(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -348,7 +348,7 @@ func (s) TestRDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
|
|||
for _, test := range tests {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -434,7 +434,7 @@ func (s) TestRDSWatch_TwoWatchesForSameResourceName(t *testing.T) {
|
|||
// The test is run with both old and new style names.
|
||||
func (s) TestRDSWatch_ThreeWatchesForDifferentResourceNames(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -520,7 +520,7 @@ func (s) TestRDSWatch_ResourceCaching(t *testing.T) {
|
|||
firstAckReceived := grpcsync.NewEvent()
|
||||
secondRequestReceived := grpcsync.NewEvent()
|
||||
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, &e2e.ManagementServerOptions{
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{
|
||||
OnStreamRequest: func(id int64, req *v3discoverypb.DiscoveryRequest) error {
|
||||
// The first request has an empty version string.
|
||||
if !firstRequestReceived && req.GetVersionInfo() == "" {
|
||||
|
|
@ -661,7 +661,7 @@ func (s) TestRDSWatch_ExpiryTimerFiresBeforeResponse(t *testing.T) {
|
|||
// invocation with error) does not take place.
|
||||
func (s) TestRDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, err := e2e.StartManagementServer(nil)
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to spin up the xDS management server: %v", err)
|
||||
}
|
||||
|
|
@ -737,7 +737,7 @@ func (s) TestRDSWatch_ValidResponseCancelsExpiryTimerBehavior(t *testing.T) {
|
|||
// propagated to the watcher.
|
||||
func (s) TestRDSWatch_NACKError(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
@ -786,7 +786,7 @@ func (s) TestRDSWatch_NACKError(t *testing.T) {
|
|||
// invalid resource receive an error.
|
||||
func (s) TestRDSWatch_PartialValid(t *testing.T) {
|
||||
overrideFedEnvVar(t)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, nil)
|
||||
mgmtServer, nodeID, bootstrapContents, _, cleanup := e2e.SetupManagementServer(t, e2e.ManagementServerOptions{})
|
||||
defer cleanup()
|
||||
|
||||
// Create an xDS client with the above bootstrap contents.
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ func (s) TestSimpleAckAndNack(t *testing.T) {
|
|||
// the test goroutine to verify ack version and nonce.
|
||||
streamRequestCh := make(chan *v3discoverypb.DiscoveryRequest, 1)
|
||||
streamResponseCh := make(chan *v3discoverypb.DiscoveryResponse, 1)
|
||||
mgmtServer, err := e2e.StartManagementServer(&e2e.ManagementServerOptions{
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{
|
||||
OnStreamRequest: func(_ int64, req *v3discoverypb.DiscoveryRequest) error {
|
||||
select {
|
||||
case streamRequestCh <- req:
|
||||
|
|
@ -273,7 +273,7 @@ func (s) TestInvalidFirstResponse(t *testing.T) {
|
|||
// the test goroutine to verify ack version and nonce.
|
||||
streamRequestCh := make(chan *v3discoverypb.DiscoveryRequest, 1)
|
||||
streamResponseCh := make(chan *v3discoverypb.DiscoveryResponse, 1)
|
||||
mgmtServer, err := e2e.StartManagementServer(&e2e.ManagementServerOptions{
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{
|
||||
OnStreamRequest: func(_ int64, req *v3discoverypb.DiscoveryRequest) error {
|
||||
select {
|
||||
case streamRequestCh <- req:
|
||||
|
|
@ -403,7 +403,7 @@ func (s) TestResourceIsNotRequestedAnymore(t *testing.T) {
|
|||
// the test goroutine to verify ack version and nonce.
|
||||
streamRequestCh := make(chan *v3discoverypb.DiscoveryRequest, 1)
|
||||
streamResponseCh := make(chan *v3discoverypb.DiscoveryResponse, 1)
|
||||
mgmtServer, err := e2e.StartManagementServer(&e2e.ManagementServerOptions{
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{
|
||||
OnStreamRequest: func(_ int64, req *v3discoverypb.DiscoveryRequest) error {
|
||||
select {
|
||||
case streamRequestCh <- req:
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ func (s) TestTransport_BackoffAfterStreamFailure(t *testing.T) {
|
|||
|
||||
// Create an xDS management server listening on a local port.
|
||||
streamErr := errors.New("ADS stream error")
|
||||
mgmtServer, err := e2e.StartManagementServer(&e2e.ManagementServerOptions{
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{
|
||||
// Push on a channel whenever the stream is closed.
|
||||
OnStreamClosed: func(int64) {
|
||||
select {
|
||||
|
|
@ -206,7 +206,7 @@ func (s) TestTransport_RetriesAfterBrokenStream(t *testing.T) {
|
|||
t.Fatalf("Failed to create a local listener for the xDS management server: %v", err)
|
||||
}
|
||||
lis := testutils.NewRestartableListener(l)
|
||||
mgmtServer, err := e2e.StartManagementServer(&e2e.ManagementServerOptions{
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{
|
||||
Listener: lis,
|
||||
// Push the received request on to a channel for the test goroutine to
|
||||
// verify that it matches expectations.
|
||||
|
|
@ -380,7 +380,7 @@ func (s) TestTransport_ResourceRequestedBeforeStreamCreation(t *testing.T) {
|
|||
lis := testutils.NewRestartableListener(l)
|
||||
streamErr := errors.New("ADS stream error")
|
||||
|
||||
mgmtServer, err := e2e.StartManagementServer(&e2e.ManagementServerOptions{
|
||||
mgmtServer, err := e2e.StartManagementServer(e2e.ManagementServerOptions{
|
||||
Listener: lis,
|
||||
|
||||
// Return an error everytime a request is sent on the stream. This
|
||||
|
|
|
|||
Loading…
Reference in New Issue