[arvados] created: 2.7.0-5655-g7737cf94d7

git repository hosting git at public.arvados.org
Fri Dec 29 19:41:09 UTC 2023


        at  7737cf94d7f912f469a1ae7e808dbd2fb1eb6c8a (commit)


commit 7737cf94d7f912f469a1ae7e808dbd2fb1eb6c8a
Author: Tom Clegg <tom at curii.com>
Date:   Fri Dec 29 14:40:35 2023 -0500

    21276: Fix unreliable test.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at curii.com>

diff --git a/lib/controller/handler_test.go b/lib/controller/handler_test.go
index 0c50a6c4be..eef0443b9a 100644
--- a/lib/controller/handler_test.go
+++ b/lib/controller/handler_test.go
@@ -99,6 +99,7 @@ func (s *HandlerSuite) TestConfigExport(c *check.C) {
 
 func (s *HandlerSuite) TestDiscoveryDocCache(c *check.C) {
 	countRailsReqs := func() int {
+		s.railsSpy.Wait()
 		n := 0
 		for _, req := range s.railsSpy.RequestDumps {
 			if bytes.Contains(req, []byte("/discovery/v1/apis/arvados/v1/rest")) {
diff --git a/sdk/go/arvadostest/proxy.go b/sdk/go/arvadostest/proxy.go
index 9940ddd3d9..85d433089a 100644
--- a/sdk/go/arvadostest/proxy.go
+++ b/sdk/go/arvadostest/proxy.go
@@ -11,6 +11,7 @@ import (
 	"net/http/httptest"
 	"net/http/httputil"
 	"net/url"
+	"sync"
 	"time"
 
 	"git.arvados.org/arvados.git/sdk/go/arvados"
@@ -30,6 +31,8 @@ type Proxy struct {
 	// If non-nil, func will be called on each incoming request
 	// before proxying it.
 	Director func(*http.Request)
+
+	wg sync.WaitGroup
 }
 
 // NewProxy returns a new Proxy that saves a dump of each reqeust
@@ -66,14 +69,25 @@ func NewProxy(c *check.C, svc arvados.Service) *Proxy {
 		Server: srv,
 		URL:    u,
 	}
+	var mtx sync.Mutex
 	rp.Director = func(r *http.Request) {
+		proxy.wg.Add(1)
+		defer proxy.wg.Done()
 		if proxy.Director != nil {
 			proxy.Director(r)
 		}
 		dump, _ := httputil.DumpRequest(r, true)
+		mtx.Lock()
 		proxy.RequestDumps = append(proxy.RequestDumps, dump)
+		mtx.Unlock()
 		r.URL.Scheme = target.Scheme
 		r.URL.Host = target.Host
 	}
 	return proxy
 }
+
+// Wait waits until all of the proxied requests that have been sent to
+// Director() have also been recorded in RequestDumps.
+func (proxy *Proxy) Wait() {
+	proxy.wg.Wait()
+}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list