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

Side by Side Diff: suite_test.go

Issue 5641054: zookeeper: turn off logging by default
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:
View unified diff | Download patch
« no previous file with comments | « reattach_test.go ('k') | zk.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
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 32
33 func (s *S) init(c *C) (*zk.Conn, chan zk.Event) { 33 func (s *S) init(c *C) (*zk.Conn, chan zk.Event) {
34 conn, watch, err := zk.Dial(s.zkAddr, 5e9) 34 conn, watch, err := zk.Dial(s.zkAddr, 5e9)
35 c.Assert(err, IsNil) 35 c.Assert(err, IsNil)
36 s.handles = append(s.handles, conn)
37 bufferedWatch := make(chan zk.Event, 256)
36 38
37 » s.handles = append(s.handles, conn) 39 » select {
38 40 » case e, ok := <-watch:
39 » event := <-watch 41 » » c.Assert(ok, Equals, true)
40 42 » » c.Assert(e.Type, Equals, zk.EVENT_SESSION)
41 » c.Assert(event.Type, Equals, zk.EVENT_SESSION) 43 » » c.Assert(e.State, Equals, zk.STATE_CONNECTED)
42 » c.Assert(event.State, Equals, zk.STATE_CONNECTED) 44 » » bufferedWatch <- e
43 45 » case <-time.After(5e9):
44 » bufferedWatch := make(chan zk.Event, 256) 46 » » c.Fatalf("timeout dialling zookeeper addr %v", s.zkAddr)
45 » bufferedWatch <- event 47 » }
46 48
47 s.liveWatches += 1 49 s.liveWatches += 1
48 go func() { 50 go func() {
49 loop: 51 loop:
50 for { 52 for {
51 select { 53 select {
52 case event, ok := <-watch: 54 case event, ok := <-watch:
53 if !ok { 55 if !ok {
54 close(bufferedWatch) 56 close(bufferedWatch)
55 break loop 57 break loop
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 if err != nil { 119 if err != nil {
118 c.Fatal("Cannot start ZooKeeper server: ", err) 120 c.Fatal("Cannot start ZooKeeper server: ", err)
119 } 121 }
120 } 122 }
121 123
122 func (s *S) TearDownSuite(c *C) { 124 func (s *S) TearDownSuite(c *C) {
123 if s.zkServer != nil { 125 if s.zkServer != nil {
124 s.zkServer.Destroy() 126 s.zkServer.Destroy()
125 } 127 }
126 } 128 }
OLDNEW
« no previous file with comments | « reattach_test.go ('k') | zk.go » ('j') | no next file with comments »

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