@@ -58,8 +58,9 @@ func (s *Suite) AllTests() []utesting.Test {
58
58
}
59
59
}
60
60
61
- // This test sends PING and expects a PONG response.
62
61
func (s * Suite ) TestPing (t * utesting.T ) {
62
+ t .Log (`This test is just a sanity check. It sends PING and expects a PONG response.` )
63
+
63
64
conn , l1 := s .listen1 (t )
64
65
defer conn .close ()
65
66
@@ -84,9 +85,10 @@ func checkPong(t *utesting.T, pong *v5wire.Pong, ping *v5wire.Ping, c net.Packet
84
85
}
85
86
}
86
87
87
- // This test sends PING with a 9-byte request ID, which isn't allowed by the spec.
88
- // The remote node should not respond.
89
88
func (s * Suite ) TestPingLargeRequestID (t * utesting.T ) {
89
+ t .Log (`This test sends PING with a 9-byte request ID, which isn't allowed by the spec.
90
+ The remote node should not respond.` )
91
+
90
92
conn , l1 := s .listen1 (t )
91
93
defer conn .close ()
92
94
@@ -103,10 +105,11 @@ func (s *Suite) TestPingLargeRequestID(t *utesting.T) {
103
105
}
104
106
}
105
107
106
- // In this test, a session is established from one IP as usual. The session is then reused
107
- // on another IP, which shouldn't work. The remote node should respond with WHOAREYOU for
108
- // the attempt from a different IP.
109
108
func (s * Suite ) TestPingMultiIP (t * utesting.T ) {
109
+ t .Log (`This test establishes a session from one IP as usual. The session is then reused
110
+ on another IP, which shouldn't work. The remote node should respond with WHOAREYOU for
111
+ the attempt from a different IP.` )
112
+
110
113
conn , l1 , l2 := s .listen2 (t )
111
114
defer conn .close ()
112
115
@@ -119,6 +122,7 @@ func (s *Suite) TestPingMultiIP(t *utesting.T) {
119
122
checkPong (t , resp .(* v5wire.Pong ), ping , l1 )
120
123
121
124
// Send on l2. This reuses the session because there is only one codec.
125
+ t .Log ("sending ping from alternate IP" , l2 .LocalAddr ())
122
126
ping2 := & v5wire.Ping {ReqID : conn .nextReqID ()}
123
127
conn .write (l2 , ping2 , nil )
124
128
switch resp := conn .read (l2 ).(type ) {
@@ -157,6 +161,10 @@ func (s *Suite) TestPingMultiIP(t *utesting.T) {
157
161
// packet instead of a handshake message packet. The remote node should respond with
158
162
// another WHOAREYOU challenge for the second packet.
159
163
func (s * Suite ) TestPingHandshakeInterrupted (t * utesting.T ) {
164
+ t .Log (`TestPingHandshakeInterrupted starts a handshake, but doesn't finish it and sends a second ordinary message
165
+ packet instead of a handshake message packet. The remote node should respond with
166
+ another WHOAREYOU challenge for the second packet.` )
167
+
160
168
conn , l1 := s .listen1 (t )
161
169
defer conn .close ()
162
170
@@ -180,8 +188,10 @@ func (s *Suite) TestPingHandshakeInterrupted(t *utesting.T) {
180
188
}
181
189
}
182
190
183
- // This test sends TALKREQ and expects an empty TALKRESP response.
184
191
func (s * Suite ) TestTalkRequest (t * utesting.T ) {
192
+ t .Log (`This test sends some examples of TALKREQ with a protocol-id of "test-protocol"
193
+ and expects an empty TALKRESP response.` )
194
+
185
195
conn , l1 := s .listen1 (t )
186
196
defer conn .close ()
187
197
@@ -201,6 +211,7 @@ func (s *Suite) TestTalkRequest(t *utesting.T) {
201
211
}
202
212
203
213
// Empty request ID.
214
+ t .Log ("sending TALKREQ with empty request-id" )
204
215
resp = conn .reqresp (l1 , & v5wire.TalkRequest {Protocol : "test-protocol" })
205
216
switch resp := resp .(type ) {
206
217
case * v5wire.TalkResponse :
@@ -215,8 +226,9 @@ func (s *Suite) TestTalkRequest(t *utesting.T) {
215
226
}
216
227
}
217
228
218
- // This test checks that the remote node returns itself for FINDNODE with distance zero.
219
229
func (s * Suite ) TestFindnodeZeroDistance (t * utesting.T ) {
230
+ t .Log (`This test checks that the remote node returns itself for FINDNODE with distance zero.` )
231
+
220
232
conn , l1 := s .listen1 (t )
221
233
defer conn .close ()
222
234
@@ -232,9 +244,11 @@ func (s *Suite) TestFindnodeZeroDistance(t *utesting.T) {
232
244
}
233
245
}
234
246
235
- // In this test, multiple nodes ping the node under test. After waiting for them to be
236
- // accepted into the remote table, the test checks that they are returned by FINDNODE.
237
247
func (s * Suite ) TestFindnodeResults (t * utesting.T ) {
248
+ t .Log (`This test pings the node under test from multiple other endpoints and node identities
249
+ (the 'bystanders'). After waiting for them to be accepted into the remote table, the test checks
250
+ that they are returned by FINDNODE.` )
251
+
238
252
// Create bystanders.
239
253
nodes := make ([]* bystander , 5 )
240
254
added := make (chan enode.ID , len (nodes ))
@@ -272,6 +286,7 @@ func (s *Suite) TestFindnodeResults(t *utesting.T) {
272
286
}
273
287
274
288
// Send FINDNODE for all distances.
289
+ t .Log ("requesting nodes" )
275
290
conn , l1 := s .listen1 (t )
276
291
defer conn .close ()
277
292
foundNodes , err := conn .findnode (l1 , dists )
0 commit comments