forked from quic-go/quic-go
use the quic.Config to set the QUIC version in the Chrome tests
This commit is contained in:
@@ -38,6 +38,7 @@ var (
|
||||
nFilesUploaded int32 // should be used atomically
|
||||
testEndpointCalled utils.AtomicBool
|
||||
doneCalled utils.AtomicBool
|
||||
version protocol.VersionNumber
|
||||
)
|
||||
|
||||
func TestChrome(t *testing.T) {
|
||||
@@ -88,7 +89,9 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
var _ = JustBeforeEach(testserver.StartQuicServer)
|
||||
var _ = JustBeforeEach(func() {
|
||||
testserver.StartQuicServer([]protocol.VersionNumber{version})
|
||||
})
|
||||
|
||||
var _ = AfterEach(func() {
|
||||
testserver.StopQuicServer()
|
||||
|
||||
@@ -11,20 +11,13 @@ import (
|
||||
|
||||
var _ = Describe("Chrome tests", func() {
|
||||
for i := range protocol.SupportedVersions {
|
||||
version := protocol.SupportedVersions[i]
|
||||
version = protocol.SupportedVersions[i]
|
||||
|
||||
Context(fmt.Sprintf("with quic version %d", version), func() {
|
||||
supportedVersionsBefore := protocol.SupportedVersions
|
||||
|
||||
BeforeEach(func() {
|
||||
if version == protocol.Version39 && os.Getenv("TRAVIS") == "true" {
|
||||
Skip("The chrome version running on Travis doesn't support QUIC 39 yet.")
|
||||
}
|
||||
protocol.SupportedVersions = []protocol.VersionNumber{version}
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
protocol.SupportedVersions = supportedVersionsBefore
|
||||
})
|
||||
|
||||
It("downloads a small file", func() {
|
||||
|
||||
@@ -24,7 +24,9 @@ func TestIntegration(t *testing.T) {
|
||||
RunSpecs(t, "GQuic Tests Suite")
|
||||
}
|
||||
|
||||
var _ = JustBeforeEach(testserver.StartQuicServer)
|
||||
var _ = JustBeforeEach(func() {
|
||||
testserver.StartQuicServer(nil)
|
||||
})
|
||||
|
||||
var _ = AfterEach(testserver.StopQuicServer)
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ var _ = Describe("Client tests", func() {
|
||||
if addr.String() != "127.0.0.1:0" {
|
||||
Fail("quic.clemente.io does not resolve to 127.0.0.1. Consider adding it to /etc/hosts.")
|
||||
}
|
||||
testserver.StartQuicServer()
|
||||
testserver.StartQuicServer(nil)
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
|
||||
@@ -7,7 +7,9 @@ import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
quic "github.com/lucas-clemente/quic-go"
|
||||
"github.com/lucas-clemente/quic-go/h2quic"
|
||||
"github.com/lucas-clemente/quic-go/internal/protocol"
|
||||
"github.com/lucas-clemente/quic-go/internal/testdata"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
@@ -75,11 +77,16 @@ func GeneratePRData(l int) []byte {
|
||||
return res
|
||||
}
|
||||
|
||||
func StartQuicServer() {
|
||||
// StartQuicServer starts a h2quic.Server.
|
||||
// versions is a slice of supported QUIC versions. It may be nil, then all supported versions are used.
|
||||
func StartQuicServer(versions []protocol.VersionNumber) {
|
||||
server = &h2quic.Server{
|
||||
Server: &http.Server{
|
||||
TLSConfig: testdata.GetTLSConfig(),
|
||||
},
|
||||
QuicConfig: &quic.Config{
|
||||
Versions: versions,
|
||||
},
|
||||
}
|
||||
|
||||
addr, err := net.ResolveUDPAddr("udp", "0.0.0.0:0")
|
||||
|
||||
Reference in New Issue
Block a user