Просмотр исходного кода

modify DispatchManager test to allow for slow shutdown

Brian Gough 11 лет назад
Родитель
Сommit
85eab2e967

+ 10 - 8
services/document-updater/test/unit/coffee/DispatchManager/DispatchManagerTests.coffee

@@ -63,11 +63,13 @@ describe "DispatchManager", ->
 				
 			
 				@worker.run()
-				
-				setTimeout () =>
-					@worker._waitForUpdateThenDispatchWorker.callCount.should.equal 3
-					done()
-				, 100
-					
-			
-	
+
+				checkStatus = () =>
+					if not @settings.shuttingDown # retry until shutdown
+						setTimeout checkStatus, 100
+						return
+					else
+						@worker._waitForUpdateThenDispatchWorker.callCount.should.equal 3
+						done()
+
+				checkStatus()