MCPcopy
hub / github.com/ha/doozerd / TestDoozerFiveNodeFailure

Function TestDoozerFiveNodeFailure

test/fail_test.go:83–124  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

81}
82
83func TestDoozerFiveNodeFailure(t *testing.T) {
84 d0 := mustRunDoozer("8040", "8080", "")
85 defer syscall.Kill(d0.Pid, 9)
86
87 time.Sleep(1e9)
88
89 d1 := mustRunDoozer("8041", "8081", "8040")
90 defer syscall.Kill(d1.Pid, 9)
91 d2 := mustRunDoozer("8042", "8082", "8040")
92 defer syscall.Kill(d2.Pid, 9)
93 d3 := mustRunDoozer("8043", "8083", "8040")
94 defer syscall.Kill(d3.Pid, 9)
95 d4 := mustRunDoozer("8044", "8084", "8040")
96 defer syscall.Kill(d4.Pid, 9)
97
98 cl, err := client.Dial("127.0.0.1:8040")
99 assert.Equal(t, nil, err)
100
101 ch, err := cl.Watch("/ctl/cal/*")
102 assert.Equal(t, nil, err)
103
104 cl.Set("/ctl/cal/2", "", "")
105 <-ch
106 <-ch
107 cl.Set("/ctl/cal/3", "", "")
108 <-ch
109 <-ch
110
111 // Give doozer time to get through initial Nops
112 time.Sleep(1e9 * 60)
113
114 // Kill an attached doozer
115 syscall.Kill(d1.Pid, 9)
116
117 // We should get something here
118 ev := <-ch
119 assert.NotEqual(t, nil, ev)
120
121 for i := 0; i < 1000; i++ {
122 cl.Noop()
123 }
124}

Callers

nothing calls this directly

Calls 2

mustRunDoozerFunction · 0.85
SetMethod · 0.80

Tested by

no test coverage detected