Revision 19ad29d2

b/test/ganeti.daemon_unittest.py
25 25
import signal
26 26
import os
27 27
import socket
28
import time
28 29

  
29 30
from ganeti import daemon
30 31

  
......
82 83

  
83 84
  def testDeferredCancel(self):
84 85
    self.mainloop.RegisterSignal(self)
85
    self.mainloop.scheduler.enter(0.1, 1, self._SendSig, [signal.SIGCHLD])
86
    handle1 = self.mainloop.scheduler.enter(0.3, 2, self._SendSig,
87
                                           [signal.SIGCHLD])
88
    handle2 = self.mainloop.scheduler.enter(0.4, 2, self._SendSig,
89
                                           [signal.SIGCHLD])
90
    self.mainloop.scheduler.enter(0, 1, self._CancelEvent, [handle1])
91
    self.mainloop.scheduler.enter(0, 1, self._CancelEvent, [handle2])
86
    now = time.time()
87
    self.mainloop.scheduler.enterabs(now + 0.1, 1, self._SendSig,
88
                                     [signal.SIGCHLD])
89
    handle1 = self.mainloop.scheduler.enterabs(now + 0.3, 2, self._SendSig,
90
                                               [signal.SIGCHLD])
91
    handle2 = self.mainloop.scheduler.enterabs(now + 0.4, 2, self._SendSig,
92
                                               [signal.SIGCHLD])
93
    self.mainloop.scheduler.enterabs(now + 0.2, 1, self._CancelEvent,
94
                                     [handle1])
95
    self.mainloop.scheduler.enterabs(now + 0.2, 1, self._CancelEvent,
96
                                     [handle2])
92 97
    self.mainloop.scheduler.enter(0.5, 1, self._SendSig, [signal.SIGTERM])
93 98
    self.mainloop.Run()
94 99
    self.assertEquals(self.sendsig_events, [signal.SIGCHLD, signal.SIGTERM])

Also available in: Unified diff