mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-03 20:27:35 +03:00
generate the streamI mock in the quic package
By doing so, we can mock private methods of the stream, so they cannot be type-asserted by users of quic-go.
This commit is contained in:
parent
54ac21fbef
commit
d2e31c04ab
19 changed files with 301 additions and 301 deletions
|
@ -91,7 +91,7 @@ var _ = Describe("Stream", func() {
|
|||
close(writeReturned)
|
||||
}()
|
||||
Consistently(writeReturned).ShouldNot(BeClosed())
|
||||
err := str.HandleRstStreamFrame(f)
|
||||
err := str.handleRstStreamFrame(f)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(queuedControlFrames).To(Equal([]wire.Frame{
|
||||
&wire.RstStreamFrame{
|
||||
|
@ -122,7 +122,7 @@ var _ = Describe("Stream", func() {
|
|||
close(writeReturned)
|
||||
}()
|
||||
Consistently(writeReturned).ShouldNot(BeClosed())
|
||||
err := str.HandleRstStreamFrame(f)
|
||||
err := str.handleRstStreamFrame(f)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(queuedControlFrames).To(Equal([]wire.Frame{
|
||||
&wire.RstStreamFrame{
|
||||
|
@ -149,7 +149,7 @@ var _ = Describe("Stream", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
close(writeReturned)
|
||||
}()
|
||||
Eventually(func() *wire.StreamFrame { return str.PopStreamFrame(1000) }).ShouldNot(BeNil())
|
||||
Eventually(func() *wire.StreamFrame { return str.popStreamFrame(1000) }).ShouldNot(BeNil())
|
||||
Eventually(writeReturned).Should(BeClosed())
|
||||
Expect(queuedControlFrames).To(BeEmpty()) // no RST_STREAM frame queued yet
|
||||
err = str.Close()
|
||||
|
@ -187,7 +187,7 @@ var _ = Describe("Stream", func() {
|
|||
It("sets a read deadline, when SetDeadline is called", func() {
|
||||
mockFC.EXPECT().UpdateHighestReceived(protocol.ByteCount(6), false).AnyTimes()
|
||||
f := &wire.StreamFrame{Data: []byte("foobar")}
|
||||
err := str.HandleStreamFrame(f)
|
||||
err := str.handleStreamFrame(f)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
str.SetDeadline(time.Now().Add(-time.Second))
|
||||
b := make([]byte, 6)
|
||||
|
@ -199,24 +199,24 @@ var _ = Describe("Stream", func() {
|
|||
|
||||
Context("saying if it is finished", func() {
|
||||
It("is finished when both the send and the receive side are finished", func() {
|
||||
str.receiveStream.CloseForShutdown(errors.New("shutdown"))
|
||||
Expect(str.receiveStream.Finished()).To(BeTrue())
|
||||
Expect(str.sendStream.Finished()).To(BeFalse())
|
||||
Expect(str.Finished()).To(BeFalse())
|
||||
str.receiveStream.closeForShutdown(errors.New("shutdown"))
|
||||
Expect(str.receiveStream.finished()).To(BeTrue())
|
||||
Expect(str.sendStream.finished()).To(BeFalse())
|
||||
Expect(str.finished()).To(BeFalse())
|
||||
})
|
||||
|
||||
It("is not finished when the receive side is finished", func() {
|
||||
str.sendStream.CloseForShutdown(errors.New("shutdown"))
|
||||
Expect(str.receiveStream.Finished()).To(BeFalse())
|
||||
Expect(str.sendStream.Finished()).To(BeTrue())
|
||||
Expect(str.Finished()).To(BeFalse())
|
||||
str.sendStream.closeForShutdown(errors.New("shutdown"))
|
||||
Expect(str.receiveStream.finished()).To(BeFalse())
|
||||
Expect(str.sendStream.finished()).To(BeTrue())
|
||||
Expect(str.finished()).To(BeFalse())
|
||||
})
|
||||
|
||||
It("is not finished when the send side is finished", func() {
|
||||
str.CloseForShutdown(errors.New("shutdown"))
|
||||
Expect(str.receiveStream.Finished()).To(BeTrue())
|
||||
Expect(str.sendStream.Finished()).To(BeTrue())
|
||||
Expect(str.Finished()).To(BeTrue())
|
||||
str.closeForShutdown(errors.New("shutdown"))
|
||||
Expect(str.receiveStream.finished()).To(BeTrue())
|
||||
Expect(str.sendStream.finished()).To(BeTrue())
|
||||
Expect(str.finished()).To(BeTrue())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue