diff --git a/h2quic/integration_test.go b/h2quic/integration_test.go index 4d7b5067..1b9d33f0 100644 --- a/h2quic/integration_test.go +++ b/h2quic/integration_test.go @@ -7,9 +7,11 @@ import ( "os" "os/exec" "runtime" + "strconv" "time" "github.com/lucas-clemente/quic-go/h2quic" + "github.com/lucas-clemente/quic-go/protocol" "github.com/lucas-clemente/quic-go/testdata" _ "github.com/lucas-clemente/quic-clients" // download clients @@ -30,18 +32,16 @@ var _ = Describe("Integration tests", func() { clientPath string ) + http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { + io.WriteString(w, "Hello, World!\n") + }) + BeforeSuite(func() { clientPath = fmt.Sprintf( "%s/src/github.com/lucas-clemente/quic-clients/client-%s-debug", os.Getenv("GOPATH"), runtime.GOOS, ) - http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) { - io.WriteString(w, "Hello, World!\n") - }) - }) - - BeforeEach(func() { server = &h2quic.Server{ Server: &http.Server{ Addr: addr, @@ -55,22 +55,26 @@ var _ = Describe("Integration tests", func() { time.Sleep(10 * time.Millisecond) }) - AfterEach(func() { + AfterSuite(func() { err := server.Close() Expect(err).NotTo(HaveOccurred()) }) - It("downloads a single file", func() { - command := exec.Command( - clientPath, - "--quic-version=32", - "--host="+host, - "--port="+port, - "https://quic.clemente.io/hello", - ) - session, err := Start(command, GinkgoWriter, GinkgoWriter) - Expect(err).NotTo(HaveOccurred()) - Eventually(session).Should(Exit(0)) - Expect(session.Out).To(Say("Hello, World!\n")) - }) + for _, version := range protocol.SupportedVersions { + Context(fmt.Sprintf("with quic version %d", version), func() { + It("downloads a single file", func() { + command := exec.Command( + clientPath, + "--quic-version="+strconv.Itoa(int(version)), + "--host="+host, + "--port="+port, + "https://quic.clemente.io/hello", + ) + session, err := Start(command, GinkgoWriter, GinkgoWriter) + Expect(err).NotTo(HaveOccurred()) + Eventually(session).Should(Exit(0)) + Expect(session.Out).To(Say("Response:\nheaders: HTTP/1.1 200\nstatus: 200\n\nbody: Hello, World!\n")) + }) + }) + } })