From ec2dbf02ddf223d06495c6e2264b0c142e599604 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Tue, 1 May 2012 18:32:32 +0000 Subject: Fix test_launcher_app to ensure service actually got started The test was not allowing the new spawned thread to execute before (incorrectly) checking if the port had been assigned. Change-Id: Ibc5c6eb7ecd78d3f8bbf934346c7b91ea6369d34 --- nova/tests/test_service.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nova/tests/test_service.py b/nova/tests/test_service.py index 0fd79f42a..fbc3e57a1 100644 --- a/nova/tests/test_service.py +++ b/nova/tests/test_service.py @@ -22,6 +22,8 @@ Unit Tests for remote procedure calls using queue import mox +from eventlet import greenthread + from nova import context from nova import db from nova import exception @@ -217,5 +219,7 @@ class TestLauncher(test.TestCase): self.assertEquals(0, self.service.port) launcher = service.Launcher() launcher.launch_server(self.service) - self.assertEquals(0, self.service.port) + # Give spawned thread a chance to execute + greenthread.sleep(0) + self.assertNotEquals(0, self.service.port) launcher.stop() -- cgit