• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Connection Backoff Interop Test Descriptions
2===============================================
3
4This test is to verify the client is reconnecting the server with correct
5backoffs as specified in
6[the spec](http://github.com/grpc/grpc/blob/master/doc/connection-backoff.md).
7The test server has a port (control_port) running a rpc service for controlling
8the server and another port (retry_port) to close any incoming tcp connections.
9The test has the following flow:
10
111. The server starts listening on control_port.
122. The client calls Start rpc on server control_port.
133. The server starts listening on retry_port.
144. The client connects to server retry_port and retries with backoff for 540s,
15which translates to about 13 retries.
165. The client calls Stop rpc on server control port.
176. The client checks the response to see whether the server thinks the backoffs
18are conforming the spec or do its own check on the backoffs in the response.
19
20Client and server use
21[test.proto](https://github.com/grpc/grpc/blob/master/src/proto/grpc/testing/test.proto).
22Each language should implement its own client. The C++ server is shared among
23languages.
24
25Client
26------
27
28Clients should accept these arguments:
29* --server_control_port=PORT
30    * The server port to connect to for rpc. For example, "8080"
31* --server_retry_port=PORT
32    * The server port to connect to for testing backoffs. For example, "8081"
33
34The client must connect to the control port without TLS. The client must connect
35to the retry port with TLS. The client should either assert on the server
36returned backoff status or check the returned backoffs on its own.
37
38Procedure of client:
39
401. Calls Start on server control port with a large deadline or no deadline,
41waits for its finish and checks it succeeded.
422. Initiates a channel connection to server retry port, which should perform
43reconnections with proper backoffs. A convienent way to achieve this is to
44call Start with a deadline of 540s. The rpc should fail with deadline exceeded.
453. Calls Stop on server control port and checks it succeeded.
464. Checks the response to see whether the server thinks the backoffs passed the
47   test.
485. Optionally, the client can do its own check on the returned backoffs.
49
50
51Server
52------
53
54A C++ server can be used for the test. Other languages do NOT need to implement
55a server. To minimize the network delay, the server binary should run on the
56same machine or on a nearby machine (in terms of network distance) with the
57client binary.
58
59A server implements the ReconnectService to its state. It also opens a
60tcp server on the retry_port, which just shuts down all incoming tcp
61connections to simulate connection failures. The server will keep a record of
62all the reconnection timestamps and return the connection backoffs in the
63response in milliseconds. The server also checks the backoffs to see whether
64they conform the spec and returns whether the client passes the test.
65
66If the server receives a Start call when another client is being tested, it
67finishes the call when the other client is done. If some other host connects
68to the server retry_port when a client is being tested, the server will log an
69error but likely would think the client fails the test.
70
71The server accepts these arguments:
72
73* --control_port=PORT
74    * The port to listen on for control rpcs. For example, "8080"
75* --retry_port=PORT
76    * The tcp server port. For example, "8081"
77
78