MCPcopy
hub / github.com/aosabook/500lines / test_failed_nodes

Method test_failed_nodes

cluster/code/test/test_integration.py:88–104  ·  view source on GitHub ↗

Full run with requests and some nodes dying midway through succeeds

(self)

Source from the content-addressed store, hash-verified

86 "got %r" % (results,))
87
88 def test_failed_nodes(self):
89 """Full run with requests and some nodes dying midway through succeeds"""
90 N = 10
91 nodes = self.setupNetwork(7)
92 results = []
93 for n in range(1, N+1):
94 req = Requester(nodes[n % 3], n, results.append)
95 self.network.set_timer(None, n+1, req.start)
96
97 # kill nodes 3 and 4 at N/2 seconds
98 self.network.set_timer(None, N/2-1, lambda: self.kill(nodes[3]))
99 self.network.set_timer(None, N/2, lambda: self.kill(nodes[4]))
100
101 self.network.set_timer(None, N * 3.0, self.network.stop)
102 self.network.run()
103 self.assertEqual((len(results), results and max(results)), (N, N*(N+1)/2),
104 "got %r" % (results,))
105
106 def test_failed_leader(self):
107 """Full run with requests and a dying leader succeeds."""

Callers

nothing calls this directly

Calls 6

setupNetworkMethod · 0.95
killMethod · 0.95
RequesterClass · 0.85
rangeFunction · 0.50
set_timerMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected