From 5d377713d6267282d1da8996841599b693f78d34 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 8 Dec 2016 11:25:25 +0000 Subject: [PATCH] Try to fix issue with acceptance tests timing out --- .../acceptance/coffee/ApplyUpdateTests.coffee | 10 ++++++++-- .../test/acceptance/coffee/JoinDocTests.coffee | 16 ++++++++-------- .../acceptance/coffee/JoinProjectTests.coffee | 8 ++++---- .../test/acceptance/coffee/LeaveDocTests.coffee | 2 +- .../acceptance/coffee/LeaveProjectTests.coffee | 8 ++++---- .../acceptance/coffee/ReceiveUpdateTests.coffee | 4 ++-- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/services/real-time/test/acceptance/coffee/ApplyUpdateTests.coffee b/services/real-time/test/acceptance/coffee/ApplyUpdateTests.coffee index b5676909cb..31d8dc2bc0 100644 --- a/services/real-time/test/acceptance/coffee/ApplyUpdateTests.coffee +++ b/services/real-time/test/acceptance/coffee/ApplyUpdateTests.coffee @@ -27,9 +27,12 @@ describe "applyOtUpdate", -> (cb) => FixturesManager.setUpDoc @project_id, {@lines, @version, @ops}, (e, {@doc_id}) => cb(e) - + (cb) => @client = RealTimeClient.connect() + @client.on "connectionAccepted", cb + + (cb) => @client.emit "joinProject", project_id: @project_id, cb (cb) => @@ -78,9 +81,12 @@ describe "applyOtUpdate", -> (cb) => FixturesManager.setUpDoc @project_id, {@lines, @version, @ops}, (e, {@doc_id}) => cb(e) - + (cb) => @client = RealTimeClient.connect() + @client.on "connectionAccepted", cb + + (cb) => @client.emit "joinProject", project_id: @project_id, cb (cb) => diff --git a/services/real-time/test/acceptance/coffee/JoinDocTests.coffee b/services/real-time/test/acceptance/coffee/JoinDocTests.coffee index ed26ea85cf..056909a627 100644 --- a/services/real-time/test/acceptance/coffee/JoinDocTests.coffee +++ b/services/real-time/test/acceptance/coffee/JoinDocTests.coffee @@ -26,10 +26,10 @@ describe "joinDoc", -> (cb) => FixturesManager.setUpDoc @project_id, {@lines, @version, @ops}, (e, {@doc_id}) => cb(e) - + (cb) => @client = RealTimeClient.connect() - @client.on "connect", cb + @client.on "connectionAccepted", cb (cb) => @client.emit "joinProject", project_id: @project_id, cb @@ -63,10 +63,10 @@ describe "joinDoc", -> (cb) => FixturesManager.setUpDoc @project_id, {@lines, @version, @ops}, (e, {@doc_id}) => cb(e) - + (cb) => @client = RealTimeClient.connect() - @client.on "connect", cb + @client.on "connectionAccepted", cb (cb) => @client.emit "joinProject", project_id: @project_id, cb @@ -100,10 +100,10 @@ describe "joinDoc", -> (cb) => FixturesManager.setUpDoc @project_id, {@lines, @version, @ops}, (e, {@doc_id}) => cb(e) - + (cb) => @client = RealTimeClient.connect() - @client.on "connect", cb + @client.on "connectionAccepted", cb (cb) => @client.emit "joinProject", project_id: @project_id, cb @@ -142,10 +142,10 @@ describe "joinDoc", -> (cb) => FixturesManager.setUpDoc @project_id, {@lines, @version, @ops}, (e, {@doc_id}) => cb(e) - + (cb) => @client = RealTimeClient.connect() - @client.on "connect", cb + @client.on "connectionAccepted", cb (cb) => @client.emit "joinProject", project_id: @project_id, cb diff --git a/services/real-time/test/acceptance/coffee/JoinProjectTests.coffee b/services/real-time/test/acceptance/coffee/JoinProjectTests.coffee index 91b0c7102f..471672f9ac 100644 --- a/services/real-time/test/acceptance/coffee/JoinProjectTests.coffee +++ b/services/real-time/test/acceptance/coffee/JoinProjectTests.coffee @@ -20,10 +20,10 @@ describe "joinProject", -> } }, (e, {@project_id, @user_id}) => cb(e) - + (cb) => @client = RealTimeClient.connect() - @client.on "connect", cb + @client.on "connectionAccepted", cb (cb) => @client.emit "joinProject", project_id: @project_id, (error, @project, @privilegeLevel, @protocolVersion) => @@ -72,10 +72,10 @@ describe "joinProject", -> } }, (e, {@project_id, @user_id}) => cb(e) - + (cb) => @client = RealTimeClient.connect() - @client.on "connect", cb + @client.on "connectionAccepted", cb (cb) => @client.emit "joinProject", project_id: @project_id, (@error, @project, @privilegeLevel, @protocolVersion) => diff --git a/services/real-time/test/acceptance/coffee/LeaveDocTests.coffee b/services/real-time/test/acceptance/coffee/LeaveDocTests.coffee index 8c676647d5..753bc79c62 100644 --- a/services/real-time/test/acceptance/coffee/LeaveDocTests.coffee +++ b/services/real-time/test/acceptance/coffee/LeaveDocTests.coffee @@ -29,7 +29,7 @@ describe "leaveDoc", -> (cb) => @client = RealTimeClient.connect() - @client.on "connect", cb + @client.on "connectionAccepted", cb (cb) => @client.emit "joinProject", project_id: @project_id, cb diff --git a/services/real-time/test/acceptance/coffee/LeaveProjectTests.coffee b/services/real-time/test/acceptance/coffee/LeaveProjectTests.coffee index 2d8c8c584f..7ef8b35c64 100644 --- a/services/real-time/test/acceptance/coffee/LeaveProjectTests.coffee +++ b/services/real-time/test/acceptance/coffee/LeaveProjectTests.coffee @@ -21,11 +21,11 @@ describe "leaveProject", -> (cb) => @clientA = RealTimeClient.connect() - @clientA.on "connect", cb + @clientA.on "connectionAccepted", cb (cb) => @clientB = RealTimeClient.connect() - @clientB.on "connect", cb + @clientB.on "connectionAccepted", cb @clientBDisconnectMessages = [] @clientB.on "clientTracking.clientDisconnected", (data) => @@ -46,7 +46,7 @@ describe "leaveProject", -> (cb) => # The API waits a little while before flushing changes - setTimeout done, require("../../../app/js/WebsocketController").FLUSH_IF_EMPTY_DELAY * 2 + setTimeout done, 1000 ], done @@ -91,7 +91,7 @@ describe "leaveProject", -> (cb) => # The API waits a little while before flushing changes - setTimeout done, require("../../../app/js/WebsocketController").FLUSH_IF_EMPTY_DELAY * 2 + setTimeout done, 1000 ], done it "should flush the project to the document updater", -> diff --git a/services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee b/services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee index fd1b9a0dfe..ec41598481 100644 --- a/services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee +++ b/services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee @@ -31,11 +31,11 @@ describe "receiveUpdate", -> (cb) => @clientA = RealTimeClient.connect() - @clientA.on "connect", cb + @clientA.on "connectionAccepted", cb (cb) => @clientB = RealTimeClient.connect() - @clientB.on "connect", cb + @clientB.on "connectionAccepted", cb (cb) => @clientA.emit "joinProject", {