Merge pull request #2610 from lucas-clemente/fix-flaky-token-test

fix flaky INVALID_TOKEN integration test
This commit is contained in:
Marten Seemann
2020-06-22 14:26:11 +07:00
committed by GitHub

View File

@@ -461,7 +461,6 @@ var _ = Describe("Handshake tests", func() {
Eventually(done).Should(BeClosed())
})
})
It("rejects invalid Retry token with the INVALID_TOKEN error", func() {
tokenChan := make(chan *quic.Token, 10)
@@ -481,11 +480,18 @@ var _ = Describe("Handshake tests", func() {
)
Expect(err).To(HaveOccurred())
Expect(err.Error()).To(ContainSubstring("INVALID_TOKEN"))
Expect(tokenChan).To(HaveLen(2))
// Receiving a Retry might lead the client to measure a very small RTT.
// Then, it sometimes would retransmit the ClientHello before receiving the ServerHello.
Expect(len(tokenChan)).To(BeNumerically(">=", 2))
token := <-tokenChan
Expect(token).To(BeNil())
token = <-tokenChan
Expect(token).ToNot(BeNil())
// If the ClientHello was retransmitted, make sure that it contained the same Retry token.
for i := 2; i < len(tokenChan); i++ {
Expect(<-tokenChan).To(Equal(token))
}
Expect(token.IsRetryToken).To(BeTrue())
})
})
})