diff options
author | Benoit Foucher <benoit@zeroc.com> | 2017-03-30 11:29:41 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2017-03-30 11:29:41 +0200 |
commit | 412fb8a008ce1f7a4444eda5e84872e47c939b27 (patch) | |
tree | 9342f0a6a257bc8bb8f4b98f6428f79751110124 /js/test/Ice/acm/Client.js | |
parent | Added back support for --valgrind option to allTests.py (diff) | |
download | ice-412fb8a008ce1f7a4444eda5e84872e47c939b27.tar.bz2 ice-412fb8a008ce1f7a4444eda5e84872e47c939b27.tar.xz ice-412fb8a008ce1f7a4444eda5e84872e47c939b27.zip |
Fixes for Ice/acm and timeout tests to be less time sensitive (ICE-7371, ICE-7555)
Diffstat (limited to 'js/test/Ice/acm/Client.js')
-rw-r--r-- | js/test/Ice/acm/Client.js | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/js/test/Ice/acm/Client.js b/js/test/Ice/acm/Client.js index 7e5137501e5..0095ebeb3cc 100644 --- a/js/test/Ice/acm/Client.js +++ b/js/test/Ice/acm/Client.js @@ -86,7 +86,7 @@ var initData = new Ice.InitializationData(); initData.properties = this._com.ice_getCommunicator().getProperties().clone(); initData.logger = this._logger; - initData.properties.setProperty("Ice.ACM.Timeout", "1"); + initData.properties.setProperty("Ice.ACM.Timeout", "2"); if(this._clientACMTimeout >= 0) { initData.properties.setProperty("Ice.ACM.Client.Timeout", "" + this._clientACMTimeout); @@ -155,13 +155,26 @@ if(!this._closed) { var now = Date.now(); - return Ice.Promise.delay(1000).then(() => { - if(Date.now() - now > 1000) - { - test(false); - } - return Ice.Promise.resolve(); - }) + var promise = Ice.Promise.delay(100); + var p = promise; + for(var i = 0; i < 20; ++i) + { + p = p.then(() => { + if(this._closed) + { + return; + } + else if(Date.now() - now >= 2000) + { + test(false); + } + else + { + return Ice.Promise.delay(100); + } + }); + } + return p; } return Ice.Promise.resolve(); } @@ -195,7 +208,7 @@ runTestCase(adapter, proxy) { - return proxy.sleep(2).then(() => + return proxy.sleep(4).then(() => { test(this._heartbeat >= 2); }); @@ -228,7 +241,7 @@ constructor(com, out) { super("invocation with no heartbeat", com, out); - this.setServerACM(1, 2, 0); // Disable heartbeat on invocations + this.setServerACM(2, 2, 0); // Disable heartbeat on invocations } runTestCase(adapter, proxy) @@ -253,15 +266,15 @@ constructor(com, out) { super("invocation with no heartbeat and close on idle", com, out); - this.setClientACM(1, 1, 0); // Only close on idle. - this.setServerACM(1, 2, 0); // Disable heartbeat on invocations + this.setClientACM(2, 1, 0); // Only close on idle. + this.setServerACM(2, 2, 0); // Disable heartbeat on invocations } runTestCase(adapter, proxy) { // No close on invocation, the call should succeed this // time. - return proxy.sleep(2).then(() => + return proxy.sleep(4).then(() => { test(this._heartbeat === 0); test(!this._closed); @@ -274,12 +287,12 @@ constructor(com, out) { super("close on idle", com, out); - this.setClientACM(1, 1, 0); // Only close on idle + this.setClientACM(2, 1, 0); // Only close on idle } runTestCase(adapter, proxy) { - return Ice.Promise.delay(2000).then(() => this.waitForClosed()).then(() => + return Ice.Promise.delay(4000).then(() => this.waitForClosed()).then(() => { test(this._heartbeat === 0); test(this._closed); @@ -292,12 +305,12 @@ constructor(com, out) { super("close on invocation", com, out); - this.setClientACM(1, 2, 0); // Only close on invocation + this.setClientACM(2, 2, 0); // Only close on invocation } runTestCase(adapter, proxy) { - return Ice.Promise.delay(1500).then(() => + return Ice.Promise.delay(3000).then(() => { test(this._heartbeat === 0); test(!this._closed); @@ -310,7 +323,7 @@ constructor(com, out) { super("close on idle and invocation", com, out); - this.setClientACM(1, 3, 0); // Only close on idle and invocation + this.setClientACM(2, 3, 0); // Only close on idle and invocation } runTestCase(adapter, proxy) @@ -320,7 +333,7 @@ // the graceful close. This allows to test whether or not // the close is graceful or forceful. // - return adapter.hold().delay(1500).then( + return adapter.hold().delay(3000).then( () => { test(this._heartbeat === 0); @@ -335,12 +348,12 @@ constructor(com, out) { super("forcefull close on idle and invocation", com, out); - this.setClientACM(1, 4, 0); // Only close on idle and invocation + this.setClientACM(2, 4, 0); // Only close on idle and invocation } runTestCase(adapter, proxy) { - return adapter.hold().delay(1500).then(() => this.waitForClosed()).then( + return adapter.hold().delay(3000).then(() => this.waitForClosed()).then( () => { test(this._heartbeat === 0); @@ -354,12 +367,12 @@ constructor(com, out) { super("heartbeat on idle", com, out); - this.setServerACM(1, -1, 2); // Enable server heartbeats. + this.setServerACM(2, -1, 2); // Enable server heartbeats. } runTestCase(adapter, proxy) { - return Ice.Promise.delay(2000).then(() => test(this._heartbeat >= 3)); + return Ice.Promise.delay(4000).then(() => test(this._heartbeat >= 3)); } } @@ -368,7 +381,7 @@ constructor(com, out) { super("heartbeat always", com, out); - this.setServerACM(1, -1, 3); // Enable server heartbeats. + this.setServerACM(2, -1, 3); // Enable server heartbeats. } runTestCase(adapter, proxy) @@ -382,9 +395,9 @@ return proxy.ice_ping(); } - for(var i = 0; i < 12; ++i) + for(var i = 0; i < 10; ++i) { - p = p.then(icePing(proxy)).delay(200); + p = p.then(icePing(proxy)).delay(400); } return p.then(() => test(this._heartbeat >= 3)); } |