Revision c2a8e8ba test/ganeti.workerpool_unittest.py
b/test/ganeti.workerpool_unittest.py | ||
---|---|---|
121 | 121 |
wp.TerminateWorkers() |
122 | 122 |
self._CheckWorkerCount(wp, 0) |
123 | 123 |
|
124 |
def testAddManyTasks(self): |
|
125 |
wp = workerpool.WorkerPool("Test", 3, DummyBaseWorker) |
|
126 |
try: |
|
127 |
self._CheckWorkerCount(wp, 3) |
|
128 |
|
|
129 |
wp.AddManyTasks(["Hello world %s" % i for i in range(10)]) |
|
130 |
wp.AddTask("A separate hello") |
|
131 |
wp.AddTask("Once more, hi!") |
|
132 |
wp.AddManyTasks([("Hello world %s" % i, ) for i in range(10)]) |
|
133 |
|
|
134 |
wp.Quiesce() |
|
135 |
|
|
136 |
self._CheckNoTasks(wp) |
|
137 |
finally: |
|
138 |
wp.TerminateWorkers() |
|
139 |
self._CheckWorkerCount(wp, 0) |
|
140 |
|
|
124 | 141 |
def _CheckNoTasks(self, wp): |
125 | 142 |
wp._lock.acquire() |
126 | 143 |
try: |
Also available in: Unified diff