Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
babb3f385d |
@@ -438,20 +438,35 @@ func TestPingPong(t *testing.T) {
|
||||
// TestQuietClientAnsweringPingStaysConnected checks that a
|
||||
// registered client that sends nothing is sent a PING each
|
||||
// time the ping interval passes, and stays connected as long
|
||||
// as it answers each one.
|
||||
// as it answers each one, whether with a PONG or with another
|
||||
// line.
|
||||
func TestQuietClientAnsweringPingStaysConnected(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newTestEnvWithShortPings(t)
|
||||
client := env.dial(t)
|
||||
client.register("answers")
|
||||
|
||||
for range 3 {
|
||||
client.readUntil(isServerPing)
|
||||
client.send("PONG :" + testServerName)
|
||||
tests := []struct {
|
||||
name string
|
||||
answer string
|
||||
}{
|
||||
{name: "PONG", answer: "PONG :" + testServerName},
|
||||
{name: "PING of its own", answer: "PING :answer"},
|
||||
}
|
||||
|
||||
client.sendAndExpect("PING :still here", "PONG")
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
env := newTestEnvWithShortPings(t)
|
||||
client := env.dial(t)
|
||||
client.register("answers")
|
||||
|
||||
for range 3 {
|
||||
client.readUntil(isServerPing)
|
||||
client.send(tt.answer)
|
||||
}
|
||||
|
||||
client.sendAndExpect("PING :still here", "still here")
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TestQuietClientNotAnsweringPingIsClosed checks that a
|
||||
|
||||
Reference in New Issue
Block a user