From 88003cb79df3c858b5279ffbafcceda6e97cfc3f Mon Sep 17 00:00:00 2001
From: Kenneth Giusti <kgiusti@gmail.com>
Date: Wed, 24 Aug 2016 11:40:15 -0400
Subject: [PATCH] Avoid sending cast after server shutdown in functional test

The server test fixtures attempt to send a cast to the server during
server cleanup.  This cast is sent after the server is shut down, so
the cast only goes as far as the message bus.  This is fine for
intermediary-based message buses such as brokers, but for
point-to-point connections this can cause the cast to hang since there
is no recipient for the cast.

Change-Id: I2967ef21deb12dc1f84f6dc97a894778aeb42666
Closes-Bug: #1616487
---
 oslo_messaging/tests/functional/utils.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/oslo_messaging/tests/functional/utils.py b/oslo_messaging/tests/functional/utils.py
index ab4387d26..21e4582b4 100644
--- a/oslo_messaging/tests/functional/utils.py
+++ b/oslo_messaging/tests/functional/utils.py
@@ -111,8 +111,9 @@ class RpcServerFixture(fixtures.Fixture):
 
     def _stop(self):
         self.thread.stop()
-        self._ctrl.cast({}, 'ping')
-        self.thread.join()
+        self.thread.join(timeout=30)
+        if self.thread.isAlive():
+            raise Exception("Server did not shutdown correctly")
 
     def ping(self, ctxt):
         pass
@@ -355,8 +356,9 @@ class NotificationFixture(fixtures.Fixture):
 
     def _stop(self):
         self.thread.stop()
-        self._ctrl.sample({}, 'shutdown', 'shutdown')
-        self.thread.join()
+        self.thread.join(timeout=30)
+        if self.thread.isAlive():
+            raise Exception("Server did not shutdown properly")
 
     def notifier(self, publisher, topic=None):
         transport = self.useFixture(TransportFixture(self.conf, self.url))