From bd452b35ca8ae5e96e4af3c7fefeb8400156e2c5 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Sat, 18 Feb 2017 13:40:28 +0700 Subject: [PATCH 1/2] support unset GOPATH in Go 1.8 in integrationtests fixes #415 --- integrationtests/drop_test.go | 8 -------- integrationtests/integration_test.go | 8 -------- .../integrationtests_suite_test.go | 18 ++++++++++++++---- integrationtests/random_rtt_test.go | 8 -------- integrationtests/rtt_test.go | 8 -------- 5 files changed, 14 insertions(+), 36 deletions(-) diff --git a/integrationtests/drop_test.go b/integrationtests/drop_test.go index eefbbb85..ce5546af 100644 --- a/integrationtests/drop_test.go +++ b/integrationtests/drop_test.go @@ -3,9 +3,7 @@ package integrationtests import ( "bytes" "fmt" - "os" "os/exec" - "runtime" "strconv" "time" @@ -28,12 +26,6 @@ var _ = Describe("Drop Proxy", func() { runDropTest := func(incomingPacketDropper, outgoingPacketDropper proxy.DropCallback, version protocol.VersionNumber) { proxyPort := 12345 - clientPath := fmt.Sprintf( - "%s/src/github.com/lucas-clemente/quic-clients/client-%s-debug", - os.Getenv("GOPATH"), - runtime.GOOS, - ) - iPort, _ := strconv.Atoi(port) var err error dropproxy, err = proxy.NewUDPProxy(proxyPort, "localhost", iPort, incomingPacketDropper, outgoingPacketDropper, 0, 0) diff --git a/integrationtests/integration_test.go b/integrationtests/integration_test.go index 150ad25a..c9c6bb13 100644 --- a/integrationtests/integration_test.go +++ b/integrationtests/integration_test.go @@ -3,9 +3,7 @@ package integrationtests import ( "bytes" "fmt" - "os" "os/exec" - "runtime" "strconv" "sync" @@ -24,12 +22,6 @@ var _ = Describe("Integration tests", func() { dataMan.GenerateData(dataLen) }) - clientPath := fmt.Sprintf( - "%s/src/github.com/lucas-clemente/quic-clients/client-%s-debug", - os.Getenv("GOPATH"), - runtime.GOOS, - ) - for i := range protocol.SupportedVersions { version := protocol.SupportedVersions[i] diff --git a/integrationtests/integrationtests_suite_test.go b/integrationtests/integrationtests_suite_test.go index 8cfb22ca..2fcbfc67 100644 --- a/integrationtests/integrationtests_suite_test.go +++ b/integrationtests/integrationtests_suite_test.go @@ -5,6 +5,7 @@ import ( "crypto/md5" "encoding/hex" "fmt" + "go/build" "io" "io/ioutil" "mime/multipart" @@ -13,6 +14,8 @@ import ( "os" "os/exec" "path" + "runtime" + "strconv" "time" @@ -35,10 +38,11 @@ const ( ) var ( - server *h2quic.Server - dataMan dataManager - port string - uploadDir string + server *h2quic.Server + dataMan dataManager + port string + uploadDir string + clientPath string docker *gexec.Session ) @@ -68,6 +72,12 @@ var _ = BeforeEach(func() { Expect(err).ToNot(HaveOccurred()) err = os.MkdirAll(uploadDir, os.ModeDir|0777) Expect(err).ToNot(HaveOccurred()) + + clientPath = fmt.Sprintf( + "%s/src/github.com/lucas-clemente/quic-clients/client-%s-debug", + build.Default.GOPATH, + runtime.GOOS, + ) }) var _ = AfterEach(func() { diff --git a/integrationtests/random_rtt_test.go b/integrationtests/random_rtt_test.go index e4d6a4b4..12e90c19 100644 --- a/integrationtests/random_rtt_test.go +++ b/integrationtests/random_rtt_test.go @@ -3,9 +3,7 @@ package integrationtests import ( "bytes" "fmt" - "os" "os/exec" - "runtime" "strconv" "time" @@ -28,12 +26,6 @@ var _ = Describe("Random RTT", func() { runRTTTest := func(minRtt, maxRtt time.Duration, version protocol.VersionNumber) { proxyPort := 12345 - clientPath := fmt.Sprintf( - "%s/src/github.com/lucas-clemente/quic-clients/client-%s-debug", - os.Getenv("GOPATH"), - runtime.GOOS, - ) - iPort, _ := strconv.Atoi(port) var err error rttProxy, err = proxy.NewUDPProxy(proxyPort, "localhost", iPort, nil, nil, minRtt, maxRtt) diff --git a/integrationtests/rtt_test.go b/integrationtests/rtt_test.go index e0a4836f..a44b25ff 100644 --- a/integrationtests/rtt_test.go +++ b/integrationtests/rtt_test.go @@ -3,9 +3,7 @@ package integrationtests import ( "bytes" "fmt" - "os" "os/exec" - "runtime" "strconv" "time" @@ -28,12 +26,6 @@ var _ = Describe("non-zero RTT", func() { runRTTTest := func(rtt time.Duration, version protocol.VersionNumber) { proxyPort := 12345 - clientPath := fmt.Sprintf( - "%s/src/github.com/lucas-clemente/quic-clients/client-%s-debug", - os.Getenv("GOPATH"), - runtime.GOOS, - ) - iPort, _ := strconv.Atoi(port) var err error rttProxy, err = proxy.NewUDPProxy(proxyPort, "localhost", iPort, nil, nil, rtt, rtt) From 901a7241973d85f9734d66bc56946e1e417087ec Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Mon, 20 Feb 2017 10:39:30 +0700 Subject: [PATCH 2/2] determine the path to the quic_clients at runtime in integration tests --- integrationtests/integrationtests_suite_test.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/integrationtests/integrationtests_suite_test.go b/integrationtests/integrationtests_suite_test.go index 2fcbfc67..a9a5442b 100644 --- a/integrationtests/integrationtests_suite_test.go +++ b/integrationtests/integrationtests_suite_test.go @@ -5,7 +5,6 @@ import ( "crypto/md5" "encoding/hex" "fmt" - "go/build" "io" "io/ioutil" "mime/multipart" @@ -14,6 +13,7 @@ import ( "os" "os/exec" "path" + "path/filepath" "runtime" "strconv" @@ -73,11 +73,11 @@ var _ = BeforeEach(func() { err = os.MkdirAll(uploadDir, os.ModeDir|0777) Expect(err).ToNot(HaveOccurred()) - clientPath = fmt.Sprintf( - "%s/src/github.com/lucas-clemente/quic-clients/client-%s-debug", - build.Default.GOPATH, - runtime.GOOS, - ) + _, thisfile, _, ok := runtime.Caller(0) + if !ok { + Fail("Failed to get current path") + } + clientPath = filepath.Join(thisfile, fmt.Sprintf("../../../quic-clients/client-%s-debug", runtime.GOOS)) }) var _ = AfterEach(func() {