[ARVADOS] updated: fdaaff3165642f03d46a628050d6dfb04cd37565
git at public.curoverse.com
git at public.curoverse.com
Thu Oct 23 15:52:08 EDT 2014
Summary of changes:
services/api/test/integration/websocket_test.rb | 43 +++++++++++++++++++++++++
1 file changed, 43 insertions(+)
via fdaaff3165642f03d46a628050d6dfb04cd37565 (commit)
from 21ccdae70baaca0c7aeca8542f2a0a431f06c313 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit fdaaff3165642f03d46a628050d6dfb04cd37565
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Thu Oct 23 15:52:04 2014 -0400
4295: Add test that large numbers of events are handled efficiently and correctly.
diff --git a/services/api/test/integration/websocket_test.rb b/services/api/test/integration/websocket_test.rb
index fbc18c5..4864c53 100644
--- a/services/api/test/integration/websocket_test.rb
+++ b/services/api/test/integration/websocket_test.rb
@@ -603,4 +603,47 @@ class WebsocketTest < ActionDispatch::IntegrationTest
end
+ test "connect, subscribe, lots of events" do
+ state = 1
+ event_count = 0
+ log_start = Log.order(:id).last.id
+
+ authorize_with :admin
+
+ ws_helper :admin, false do |ws|
+ EM::Timer.new 8 do
+ # Needs a longer timeout than the default
+ ws.close
+ end
+
+ ws.on :open do |event|
+ ws.send ({method: 'subscribe'}.to_json)
+ end
+
+ ws.on :message do |event|
+ d = Oj.load event.data
+ case state
+ when 1
+ assert_equal 200, d["status"]
+ ActiveRecord::Base.transaction do
+ (1..202).each do
+ spec = Specimen.create
+ end
+ end
+ state = 2
+ when 2
+ event_count += 1
+ assert_equal d['id'], event_count+log_start
+ if event_count == 202
+ ws.close
+ end
+ end
+ end
+
+ end
+
+ assert_equal 202, event_count
+ end
+
+
end
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list