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