mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-04 12:47:36 +03:00
integrationtests: remove leftover code for Go 1.19 (#4193)
This commit is contained in:
parent
659da8ca08
commit
a7a66f6437
3 changed files with 41 additions and 86 deletions
|
@ -1,21 +0,0 @@
|
|||
//go:build go1.19 && !go1.20
|
||||
|
||||
package self_test
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const go120 = false
|
||||
|
||||
var errNotSupported = errors.New("not supported")
|
||||
|
||||
func setReadDeadline(w http.ResponseWriter, deadline time.Time) error {
|
||||
return errNotSupported
|
||||
}
|
||||
|
||||
func setWriteDeadline(w http.ResponseWriter, deadline time.Time) error {
|
||||
return errNotSupported
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
//go:build go1.20
|
||||
|
||||
package self_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
const go120 = true
|
||||
|
||||
func setReadDeadline(w http.ResponseWriter, deadline time.Time) error {
|
||||
rc := http.NewResponseController(w)
|
||||
|
||||
return rc.SetReadDeadline(deadline)
|
||||
}
|
||||
|
||||
func setWriteDeadline(w http.ResponseWriter, deadline time.Time) error {
|
||||
rc := http.NewResponseController(w)
|
||||
|
||||
return rc.SetWriteDeadline(deadline)
|
||||
}
|
|
@ -432,12 +432,11 @@ var _ = Describe("HTTP tests", func() {
|
|||
Eventually(done).Should(BeClosed())
|
||||
})
|
||||
|
||||
if go120 {
|
||||
It("supports read deadlines", func() {
|
||||
mux.HandleFunc("/read-deadline", func(w http.ResponseWriter, r *http.Request) {
|
||||
defer GinkgoRecover()
|
||||
err := setReadDeadline(w, time.Now().Add(deadlineDelay))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
rc := http.NewResponseController(w)
|
||||
Expect(rc.SetReadDeadline(time.Now().Add(deadlineDelay))).To(Succeed())
|
||||
|
||||
body, err := io.ReadAll(r.Body)
|
||||
Expect(err).To(MatchError(os.ErrDeadlineExceeded))
|
||||
|
@ -464,10 +463,10 @@ var _ = Describe("HTTP tests", func() {
|
|||
It("supports write deadlines", func() {
|
||||
mux.HandleFunc("/write-deadline", func(w http.ResponseWriter, r *http.Request) {
|
||||
defer GinkgoRecover()
|
||||
err := setWriteDeadline(w, time.Now().Add(deadlineDelay))
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
rc := http.NewResponseController(w)
|
||||
Expect(rc.SetWriteDeadline(time.Now().Add(deadlineDelay))).To(Succeed())
|
||||
|
||||
_, err = io.Copy(w, neverEnding('a'))
|
||||
_, err := io.Copy(w, neverEnding('a'))
|
||||
Expect(err).To(MatchError(os.ErrDeadlineExceeded))
|
||||
})
|
||||
|
||||
|
@ -482,5 +481,4 @@ var _ = Describe("HTTP tests", func() {
|
|||
Expect(time.Now().After(expectedEnd)).To(BeTrue())
|
||||
Expect(string(body)).To(ContainSubstring("aa"))
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue