Skip to content

Commit

Permalink
Additional connect timeout test (#2716)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone authored Sep 4, 2024
1 parent e7fe6bc commit b1afb78
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 6 deletions.
15 changes: 13 additions & 2 deletions cpp/test/Ice/timeout/AllTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,26 @@ allTestsWithController(Test::TestHelper* helper, const ControllerPrx& controller
controller->holdAdapter(-1);
try
{
timeout->op();
timeout->ice_connectionId("connection-1")->op();
test(false);
}
catch (const Ice::ConnectTimeoutException&)
{
// Expected.
}

try
{
timeout->ice_connectionId("connection-2")->op();
test(false);
}
catch (const Ice::ConnectTimeoutException&)
{
// Expected.
}
controller->resumeAdapter();
timeout->op(); // Ensure adapter is active.
// Retrying with a new connection.
timeout->ice_connectionId("connection-3")->op();
}
{
//
Expand Down
19 changes: 17 additions & 2 deletions csharp/test/Ice/timeout/AllTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,30 @@ public static async Task allTestsWithController(global::Test.TestHelper helper,
controller.holdAdapter(-1);
try
{
timeout.op();
Test.TimeoutPrxHelper.uncheckedCast(timeout.ice_connectionId("connection-1")).op();
test(false);
}
catch (ConnectTimeoutException)
{
// Expected.
}

if (!Ice.Internal.AssemblyUtil.isMacOS)
{
// Workaround for macOS bug
// See: https://github.com/dotnet/runtime/issues/102663
try
{
Test.TimeoutPrxHelper.uncheckedCast(timeout.ice_connectionId("connection-2")).op();
test(false);
}
catch (ConnectTimeoutException)
{
// Expected.
}
}
controller.resumeAdapter();
timeout.op(); // Ensure adapter is active.
Test.TimeoutPrxHelper.uncheckedCast(timeout.ice_connectionId("connection-3")).op(); // Ensure adapter is active.
}
{
//
Expand Down
12 changes: 10 additions & 2 deletions java/test/src/main/java/test/Ice/timeout/AllTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,21 @@ public static void allTestsWithController(test.TestHelper helper, ControllerPrx
//
controller.holdAdapter(-1);
try {
timeout.op();
TimeoutPrx.uncheckedCast(timeout.ice_connectionId("connection-1")).op();
test(false);
} catch (com.zeroc.Ice.ConnectTimeoutException ex) {
// Expected.
}

try {
TimeoutPrx.uncheckedCast(timeout.ice_connectionId("connection-2")).op();
test(false);
} catch (com.zeroc.Ice.ConnectTimeoutException ex) {
// Expected.
}
controller.resumeAdapter();
timeout.op(); // Ensure adapter is active.
// Retrying with a new connection.
TimeoutPrx.uncheckedCast(timeout.ice_connectionId("connection-3")).op();
}
{
//
Expand Down

0 comments on commit b1afb78

Please sign in to comment.