1*cc02d7e2SAndroid Build Coastguard WorkerConnection Backoff Interop Test Descriptions 2*cc02d7e2SAndroid Build Coastguard Worker=============================================== 3*cc02d7e2SAndroid Build Coastguard Worker 4*cc02d7e2SAndroid Build Coastguard WorkerThis test is to verify the client is reconnecting the server with correct 5*cc02d7e2SAndroid Build Coastguard Workerbackoffs as specified in 6*cc02d7e2SAndroid Build Coastguard Worker[the spec](https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md). 7*cc02d7e2SAndroid Build Coastguard WorkerThe test server has a port (control_port) running a rpc service for controlling 8*cc02d7e2SAndroid Build Coastguard Workerthe server and another port (retry_port) to close any incoming tcp connections. 9*cc02d7e2SAndroid Build Coastguard WorkerThe test has the following flow: 10*cc02d7e2SAndroid Build Coastguard Worker 11*cc02d7e2SAndroid Build Coastguard Worker1. The server starts listening on control_port. 12*cc02d7e2SAndroid Build Coastguard Worker2. The client calls Start rpc on server control_port. 13*cc02d7e2SAndroid Build Coastguard Worker3. The server starts listening on retry_port. 14*cc02d7e2SAndroid Build Coastguard Worker4. The client connects to server retry_port and retries with backoff for 540s, 15*cc02d7e2SAndroid Build Coastguard Workerwhich translates to about 13 retries. 16*cc02d7e2SAndroid Build Coastguard Worker5. The client calls Stop rpc on server control port. 17*cc02d7e2SAndroid Build Coastguard Worker6. The client checks the response to see whether the server thinks the backoffs 18*cc02d7e2SAndroid Build Coastguard Workerare conforming the spec or do its own check on the backoffs in the response. 19*cc02d7e2SAndroid Build Coastguard Worker 20*cc02d7e2SAndroid Build Coastguard WorkerClient and server use 21*cc02d7e2SAndroid Build Coastguard Worker[test.proto](https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/test.proto). 22*cc02d7e2SAndroid Build Coastguard WorkerEach language should implement its own client. The C++ server is shared among 23*cc02d7e2SAndroid Build Coastguard Workerlanguages. 24*cc02d7e2SAndroid Build Coastguard Worker 25*cc02d7e2SAndroid Build Coastguard WorkerClient 26*cc02d7e2SAndroid Build Coastguard Worker------ 27*cc02d7e2SAndroid Build Coastguard Worker 28*cc02d7e2SAndroid Build Coastguard WorkerClients should accept these arguments: 29*cc02d7e2SAndroid Build Coastguard Worker* --server_control_port=PORT 30*cc02d7e2SAndroid Build Coastguard Worker * The server port to connect to for rpc. For example, "8080" 31*cc02d7e2SAndroid Build Coastguard Worker* --server_retry_port=PORT 32*cc02d7e2SAndroid Build Coastguard Worker * The server port to connect to for testing backoffs. For example, "8081" 33*cc02d7e2SAndroid Build Coastguard Worker 34*cc02d7e2SAndroid Build Coastguard WorkerThe client must connect to the control port without TLS. The client must connect 35*cc02d7e2SAndroid Build Coastguard Workerto the retry port with TLS. The client should either assert on the server 36*cc02d7e2SAndroid Build Coastguard Workerreturned backoff status or check the returned backoffs on its own. 37*cc02d7e2SAndroid Build Coastguard Worker 38*cc02d7e2SAndroid Build Coastguard WorkerProcedure of client: 39*cc02d7e2SAndroid Build Coastguard Worker 40*cc02d7e2SAndroid Build Coastguard Worker1. Calls Start on server control port with a large deadline or no deadline, 41*cc02d7e2SAndroid Build Coastguard Workerwaits for its finish and checks it succeeded. 42*cc02d7e2SAndroid Build Coastguard Worker2. Initiates a channel connection to server retry port, which should perform 43*cc02d7e2SAndroid Build Coastguard Workerreconnections with proper backoffs. A convenient way to achieve this is to 44*cc02d7e2SAndroid Build Coastguard Workercall Start with a deadline of 540s. The rpc should fail with deadline exceeded. 45*cc02d7e2SAndroid Build Coastguard Worker3. Calls Stop on server control port and checks it succeeded. 46*cc02d7e2SAndroid Build Coastguard Worker4. Checks the response to see whether the server thinks the backoffs passed the 47*cc02d7e2SAndroid Build Coastguard Worker test. 48*cc02d7e2SAndroid Build Coastguard Worker5. Optionally, the client can do its own check on the returned backoffs. 49*cc02d7e2SAndroid Build Coastguard Worker 50*cc02d7e2SAndroid Build Coastguard Worker 51*cc02d7e2SAndroid Build Coastguard WorkerServer 52*cc02d7e2SAndroid Build Coastguard Worker------ 53*cc02d7e2SAndroid Build Coastguard Worker 54*cc02d7e2SAndroid Build Coastguard WorkerA C++ server can be used for the test. Other languages do NOT need to implement 55*cc02d7e2SAndroid Build Coastguard Workera server. To minimize the network delay, the server binary should run on the 56*cc02d7e2SAndroid Build Coastguard Workersame machine or on a nearby machine (in terms of network distance) with the 57*cc02d7e2SAndroid Build Coastguard Workerclient binary. 58*cc02d7e2SAndroid Build Coastguard Worker 59*cc02d7e2SAndroid Build Coastguard WorkerA server implements the ReconnectService to its state. It also opens a 60*cc02d7e2SAndroid Build Coastguard Workertcp server on the retry_port, which just shuts down all incoming tcp 61*cc02d7e2SAndroid Build Coastguard Workerconnections to simulate connection failures. The server will keep a record of 62*cc02d7e2SAndroid Build Coastguard Workerall the reconnection timestamps and return the connection backoffs in the 63*cc02d7e2SAndroid Build Coastguard Workerresponse in milliseconds. The server also checks the backoffs to see whether 64*cc02d7e2SAndroid Build Coastguard Workerthey conform the spec and returns whether the client passes the test. 65*cc02d7e2SAndroid Build Coastguard Worker 66*cc02d7e2SAndroid Build Coastguard WorkerIf the server receives a Start call when another client is being tested, it 67*cc02d7e2SAndroid Build Coastguard Workerfinishes the call when the other client is done. If some other host connects 68*cc02d7e2SAndroid Build Coastguard Workerto the server retry_port when a client is being tested, the server will log an 69*cc02d7e2SAndroid Build Coastguard Workererror but likely would think the client fails the test. 70*cc02d7e2SAndroid Build Coastguard Worker 71*cc02d7e2SAndroid Build Coastguard WorkerThe server accepts these arguments: 72*cc02d7e2SAndroid Build Coastguard Worker 73*cc02d7e2SAndroid Build Coastguard Worker* --control_port=PORT 74*cc02d7e2SAndroid Build Coastguard Worker * The port to listen on for control rpcs. For example, "8080" 75*cc02d7e2SAndroid Build Coastguard Worker* --retry_port=PORT 76*cc02d7e2SAndroid Build Coastguard Worker * The tcp server port. For example, "8081" 77*cc02d7e2SAndroid Build Coastguard Worker 78