Spins up an xDS management server and sets up an xDS bootstrap configuration file that points to it. Returns the following: - A reference to the xDS management server - A channel to read requested Listener resource names - A channel to read requested RouteConfiguration resource names - Contents of
(t *testing.T, nodeID string)
| 214 | // - Contents of the bootstrap configuration pointing to xDS management |
| 215 | // server |
| 216 | func setupManagementServerForTest(t *testing.T, nodeID string) (*e2e.ManagementServer, chan []string, chan []string, []byte) { |
| 217 | t.Helper() |
| 218 | |
| 219 | listenerResourceNamesCh := make(chan []string, 1) |
| 220 | routeConfigResourceNamesCh := make(chan []string, 1) |
| 221 | |
| 222 | // Setup the management server to push the requested listener and route |
| 223 | // configuration resource names on to separate channels for the test to |
| 224 | // inspect. |
| 225 | mgmtServer := e2e.StartManagementServer(t, e2e.ManagementServerOptions{ |
| 226 | OnStreamRequest: func(_ int64, req *v3discoverypb.DiscoveryRequest) error { |
| 227 | switch req.GetTypeUrl() { |
| 228 | case version.V3ListenerURL: |
| 229 | select { |
| 230 | case <-listenerResourceNamesCh: |
| 231 | default: |
| 232 | } |
| 233 | select { |
| 234 | case listenerResourceNamesCh <- req.GetResourceNames(): |
| 235 | default: |
| 236 | } |
| 237 | case version.V3RouteConfigURL: |
| 238 | select { |
| 239 | case <-routeConfigResourceNamesCh: |
| 240 | default: |
| 241 | } |
| 242 | select { |
| 243 | case routeConfigResourceNamesCh <- req.GetResourceNames(): |
| 244 | default: |
| 245 | } |
| 246 | } |
| 247 | return nil |
| 248 | }, |
| 249 | AllowResourceSubset: true, |
| 250 | }) |
| 251 | |
| 252 | // Create a bootstrap configuration specifying the above management server. |
| 253 | bootstrapContents := e2e.DefaultBootstrapContents(t, nodeID, mgmtServer.Address) |
| 254 | return mgmtServer, listenerResourceNamesCh, routeConfigResourceNamesCh, bootstrapContents |
| 255 | } |
| 256 | |
| 257 | // Updates all resources on the given management server. |
| 258 | func configureResources(ctx context.Context, t *testing.T, mgmtServer *e2e.ManagementServer, nodeID string, listeners []*v3listenerpb.Listener, routes []*v3routepb.RouteConfiguration, clusters []*v3clusterpb.Cluster, endpoints []*v3endpointpb.ClusterLoadAssignment) { |
no test coverage detected