diff options
author | Benoit Foucher <benoit@zeroc.com> | 2019-08-22 16:14:09 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2019-08-22 16:14:09 +0200 |
commit | b0f6341f4ef05ee6f59b61bb18e7722e3f96347d (patch) | |
tree | b6653af34c38222d0e1f4eed9d6674caadf5a0c0 /js | |
parent | Workaround for AIX issue with SSL_write and EWOULDBLOCK (diff) | |
download | ice-b0f6341f4ef05ee6f59b61bb18e7722e3f96347d.tar.bz2 ice-b0f6341f4ef05ee6f59b61bb18e7722e3f96347d.tar.xz ice-b0f6341f4ef05ee6f59b61bb18e7722e3f96347d.zip |
Fixed Ice/timeout test to ensure the client doesn't hang in case of test failure
Diffstat (limited to 'js')
-rw-r--r-- | js/test/Ice/timeout/Client.js | 22 | ||||
-rw-r--r-- | js/test/typescript/Ice/timeout/Client.ts | 18 |
2 files changed, 36 insertions, 4 deletions
diff --git a/js/test/Ice/timeout/Client.js b/js/test/Ice/timeout/Client.js index 295405aa809..74b1a89e844 100644 --- a/js/test/Ice/timeout/Client.js +++ b/js/test/Ice/timeout/Client.js @@ -13,6 +13,24 @@ { async allTests() { + const controller = Test.ControllerPrx.uncheckedCast( + this.communicator().stringToProxy("controller:" + this.getTestEndpoint(1))); + test(controller !== null); + try + { + await this.allTestsWithController(controller); + } + catch(ex) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent the test + // from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter(); + throw ex; + } + } + + async allTestsWithController(controller) + { async function connect(prx) { let nRetry = 10; @@ -51,10 +69,6 @@ const timeout = await Test.TimeoutPrx.checkedCast(obj); test(timeout !== null); - const controller = Test.ControllerPrx.uncheckedCast( - communicator.stringToProxy("controller:" + this.getTestEndpoint(1))); - test(controller !== null); - out.write("testing connect timeout... "); { const to = Test.TimeoutPrx.uncheckedCast(obj.ice_timeout(100 * mult)); diff --git a/js/test/typescript/Ice/timeout/Client.ts b/js/test/typescript/Ice/timeout/Client.ts index 1d19ea8b771..1234cce4147 100644 --- a/js/test/typescript/Ice/timeout/Client.ts +++ b/js/test/typescript/Ice/timeout/Client.ts @@ -12,6 +12,24 @@ export class Client extends TestHelper { async allTests() { + const controller = Test.ControllerPrx.uncheckedCast( + this.communicator().stringToProxy("controller:" + this.getTestEndpoint(1))); + test(controller !== null); + try + { + await this.allTestsWithController(controller); + } + catch(ex) + { + // Ensure the adapter is not in the holding state when an unexpected exception occurs to prevent the test + // from hanging on exit in case a connection which disables timeouts is still opened. + controller.resumeAdapter(); + throw ex; + } + } + + async allTestsWithController(controller:Test.ControllerPrx) + { async function connect(prx:Test.TimeoutPrx) { let nRetry = 10; |