forked from quic-go/quic-go
fix check for STK generation time
This commit is contained in:
@@ -38,7 +38,9 @@ var _ = Describe("STK Generator", func() {
|
||||
stk, err := stkGen.DecodeToken(token)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(stk.RemoteAddr).To(Equal("192.168.0.1"))
|
||||
Expect(stk.SentTime).To(BeTemporally("~", time.Now(), time.Second))
|
||||
// the time resolution of the STK is just 1 second
|
||||
// if STK generation and this check happen in "different seconds", the difference will be between 1 and 2 seconds
|
||||
Expect(stk.SentTime).To(BeTemporally("~", time.Now(), 2*time.Second))
|
||||
})
|
||||
|
||||
It("rejects invalid tokens", func() {
|
||||
@@ -89,7 +91,9 @@ var _ = Describe("STK Generator", func() {
|
||||
stk, err := stkGen.DecodeToken(token)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(stk.RemoteAddr).To(Equal(ip.String()))
|
||||
Expect(stk.SentTime).To(BeTemporally("~", time.Now(), time.Second))
|
||||
// the time resolution of the STK is just 1 second
|
||||
// if STK generation and this check happen in "different seconds", the difference will be between 1 and 2 seconds
|
||||
Expect(stk.SentTime).To(BeTemporally("~", time.Now(), 2*time.Second))
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user