Ejemplo n.º 1
0
 def test_interval_None(self):
     """Test generator with interval=None"""
     gen = heartbeat_generator(None, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(5)
Ejemplo n.º 2
0
 def test_interval_None(self):
     """Test generator with interval=None"""
     gen = heartbeat_generator(None, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(5)
Ejemplo n.º 3
0
 def test_send_heartbeat_on_interval(self):
     """Test that we actually send the heartbeat."""
     gen = heartbeat_generator(2, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(2)
     gen.next()
     output = self.stdout.buflist
     self.assertTrue('<!--XSUPERVISOR:BEGIN-->' in output)
     self.assertTrue('<!--XSUPERVISOR:END-->' in output)
Ejemplo n.º 4
0
 def test_send_heartbeat_on_interval(self):
     """Test that we actually send the heartbeat."""
     gen = heartbeat_generator(2, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(2)
     gen.next()
     output = self.stdout.buflist
     self.assertTrue('<!--XSUPERVISOR:BEGIN-->' in output)
     self.assertTrue('<!--XSUPERVISOR:END-->' in output)
Ejemplo n.º 5
0
 def test_not_send_heartbeat(self):
     """Test that we don't send the heartbeat."""
     gen = heartbeat_generator(2, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(0.5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(0.5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
Ejemplo n.º 6
0
 def test_not_send_heartbeat(self):
     """Test that we don't send the heartbeat."""
     gen = heartbeat_generator(2, out=self.stdout, time=self.timer)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(0.5)
     gen.next()
     self.assertFalse(self.stdout.buflist)
     self.timer.advance(0.5)
     gen.next()
     self.assertFalse(self.stdout.buflist)