[ARVADOS] updated: f36162457a771824059fefa098a3ffb89c59263f

Git user git at public.curoverse.com
Wed Mar 1 02:53:46 EST 2017


Summary of changes:
 services/ws/session_v0_test.go | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

       via  f36162457a771824059fefa098a3ffb89c59263f (commit)
      from  b3fa9983ac0b7b38a5b3787af56a7bb1502ae3be (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f36162457a771824059fefa098a3ffb89c59263f
Author: Tom Clegg <tom at curoverse.com>
Date:   Wed Mar 1 02:52:38 2017 -0500

    10764: Simplify test server shutdown.

diff --git a/services/ws/session_v0_test.go b/services/ws/session_v0_test.go
index f4dc23f..d8a2b69 100644
--- a/services/ws/session_v0_test.go
+++ b/services/ws/session_v0_test.go
@@ -242,11 +242,13 @@ func (s *v0Suite) testClient() (*testServer, *websocket.Conn, *json.Decoder, *js
 type testServer struct {
 	http.Server
 	addr string
-	stop chan bool
+	ln   net.Listener
+	pges *pgEventSource
 }
 
 func (srv *testServer) Close() {
-	close(srv.stop)
+	srv.ln.Close()
+	srv.pges.cancel()
 }
 
 func newTestServer() *testServer {
@@ -256,7 +258,7 @@ func newTestServer() *testServer {
 	}
 	cfg := defaultConfig()
 	cfg.Client = *(arvados.NewClientFromEnv())
-	es := &pgEventSource{
+	pges := &pgEventSource{
 		DataSource: testDBConfig().ConnectionString(),
 		QueueSize:  4,
 	}
@@ -267,20 +269,16 @@ func newTestServer() *testServer {
 			WriteTimeout: 10 * time.Second,
 			Handler: &router{
 				Config:         &cfg,
-				eventSource:    es,
+				eventSource:    pges,
 				newPermChecker: func() permChecker { return newPermChecker(cfg.Client) },
 			},
 		},
 		addr: ln.Addr().String(),
-		stop: make(chan bool),
+		ln:   ln,
+		pges: pges,
 	}
-	go es.Run()
+	go pges.Run()
 	go srv.Serve(ln)
-	go func() {
-		<-srv.stop
-		ln.Close()
-		es.cancel()
-	}()
-	es.waitReady()
+	pges.waitReady()
 	return srv
 }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list