Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(678)

Delta Between Two Patch Sets: suite_test.go

Issue 5641054: zookeeper: turn off logging by default
Left Patch Set: zookeeper: turn off logging by default Created 12 years, 1 month ago
Right Patch Set: zookeeper: turn off logging by default Created 12 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « reattach_test.go ('k') | zk.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 package zookeeper_test 1 package zookeeper_test
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
5 . "launchpad.net/gocheck" 5 . "launchpad.net/gocheck"
6 zk "launchpad.net/gozk/zookeeper" 6 zk "launchpad.net/gozk/zookeeper"
7 "os" 7 "os"
8 "testing" 8 "testing"
9 "time" 9 "time"
10 ) 10 )
(...skipping 11 matching lines...) Expand all
22 zkProcess *os.Process // The running ZooKeeper process 22 zkProcess *os.Process // The running ZooKeeper process
23 zkAddr string 23 zkAddr string
24 24
25 handles []*zk.Conn 25 handles []*zk.Conn
26 events []*zk.Event 26 events []*zk.Event
27 liveWatches int 27 liveWatches int
28 deadWatches chan bool 28 deadWatches chan bool
29 } 29 }
30 30
31 var logLevel = 0 //zk.LOG_ERROR 31 var logLevel = 0 //zk.LOG_ERROR
32
33 func dialWithTimeout(c *C, addr string, timeout time.Duration) (*zk.Conn, <-chan zk.Event) {
34 conn, watch, err := zk.Dial(addr, timeout)
35 c.Assert(err, IsNil)
36
37 select {
38 case e, ok := <-watch:
39 c.Assert(ok, Equals, true)
40 c.Assert(e.Type, Equals, zk.EVENT_SESSION)
41 c.Assert(e.State, Equals, zk.STATE_CONNECTED)
42 case <-time.After(timeout):
43 conn.Close()
44 c.Fatalf("timeout dialling zookeeper addr %v", addr)
45 }
46 return conn, watch
47 }
48 32
49 func (s *S) init(c *C) (*zk.Conn, chan zk.Event) { 33 func (s *S) init(c *C) (*zk.Conn, chan zk.Event) {
50 conn, watch, err := zk.Dial(s.zkAddr, 5e9) 34 conn, watch, err := zk.Dial(s.zkAddr, 5e9)
51 c.Assert(err, IsNil) 35 c.Assert(err, IsNil)
52 s.handles = append(s.handles, conn) 36 s.handles = append(s.handles, conn)
53 bufferedWatch := make(chan zk.Event, 256) 37 bufferedWatch := make(chan zk.Event, 256)
54 38
55 select { 39 select {
56 case e, ok := <-watch: 40 case e, ok := <-watch:
57 c.Assert(ok, Equals, true) 41 c.Assert(ok, Equals, true)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 if err != nil { 119 if err != nil {
136 c.Fatal("Cannot start ZooKeeper server: ", err) 120 c.Fatal("Cannot start ZooKeeper server: ", err)
137 } 121 }
138 } 122 }
139 123
140 func (s *S) TearDownSuite(c *C) { 124 func (s *S) TearDownSuite(c *C) {
141 if s.zkServer != nil { 125 if s.zkServer != nil {
142 s.zkServer.Destroy() 126 s.zkServer.Destroy()
143 } 127 }
144 } 128 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b