diff options
Diffstat (limited to 'vespalib/src/tests/portal')
-rw-r--r-- | vespalib/src/tests/portal/handle_manager/handle_manager_test.cpp | 9 | ||||
-rw-r--r-- | vespalib/src/tests/portal/portal_test.cpp | 11 | ||||
-rw-r--r-- | vespalib/src/tests/portal/reactor/reactor_test.cpp | 9 |
3 files changed, 12 insertions, 17 deletions
diff --git a/vespalib/src/tests/portal/handle_manager/handle_manager_test.cpp b/vespalib/src/tests/portal/handle_manager/handle_manager_test.cpp index 4ce25aa0a7a..844622577e2 100644 --- a/vespalib/src/tests/portal/handle_manager/handle_manager_test.cpp +++ b/vespalib/src/tests/portal/handle_manager/handle_manager_test.cpp @@ -1,11 +1,8 @@ // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> +#include <vespa/vespalib/testkit/time_bomb.h> #include <vespa/vespalib/portal/handle_manager.h> -#include <vespa/vespalib/util/gate.h> - -#include <thread> -#include <chrono> #include <atomic> using namespace vespalib; @@ -85,9 +82,9 @@ TEST_MT_FF("require that destroy waits for active handle guards", 2, Fixture(), { auto guard = f1.manager.lock(f1.handle); TEST_BARRIER(); // #1 - EXPECT_TRUE(!f1.gate.await(20)); + EXPECT_TRUE(!f1.gate.await(20ms)); } - EXPECT_TRUE(f1.gate.await(60000)); + EXPECT_TRUE(f1.gate.await(60s)); } else { TEST_BARRIER(); // #1 EXPECT_TRUE(f1.manager.destroy(f1.handle)); diff --git a/vespalib/src/tests/portal/portal_test.cpp b/vespalib/src/tests/portal/portal_test.cpp index 07d3b9e1bfb..d708f81bdde 100644 --- a/vespalib/src/tests/portal/portal_test.cpp +++ b/vespalib/src/tests/portal/portal_test.cpp @@ -1,6 +1,7 @@ // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> +#include <vespa/vespalib/testkit/time_bomb.h> #include <vespa/vespalib/portal/portal.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/stringfmt.h> @@ -305,7 +306,7 @@ TEST_MT_FF("require that GET requests can be completed in another thread", 2, if (thread_id == 0) { Portal::GetRequest req = f1.latch.read(); f1.exit_callback.countDown(); - std::this_thread::sleep_for(std::chrono::milliseconds(5)); + std::this_thread::sleep_for(5ms); req.respond_with_content("text/plain", "hello"); } else { auto result = fetch(f1.portal->listen_port(), null_crypto(), "/test"); @@ -318,9 +319,9 @@ TEST_MT_FFF("require that bind token destruction waits for active callbacks", 3, { if (thread_id == 0) { Portal::GetRequest req = f1.latch.read(); - EXPECT_TRUE(!f2.await(20)); + EXPECT_TRUE(!f2.await(20ms)); f1.exit_callback.countDown(); - EXPECT_TRUE(f2.await(60000)); + EXPECT_TRUE(f2.await(60s)); req.respond_with_content("application/json", "[1,2,3]"); } else if (thread_id == 1) { f1.enter_callback.await(); @@ -338,9 +339,9 @@ TEST_MT_FFF("require that portal destruction waits for request completion", 3, if (thread_id == 0) { Portal::GetRequest req = f1.latch.read(); f1.exit_callback.countDown(); - EXPECT_TRUE(!f2.await(20)); + EXPECT_TRUE(!f2.await(20ms)); req.respond_with_content("application/json", "[1,2,3]"); - EXPECT_TRUE(f2.await(60000)); + EXPECT_TRUE(f2.await(60s)); } else if (thread_id == 1) { f1.enter_callback.await(); f1.bound.reset(); diff --git a/vespalib/src/tests/portal/reactor/reactor_test.cpp b/vespalib/src/tests/portal/reactor/reactor_test.cpp index b0abc2c9e46..b14bb1dbd3f 100644 --- a/vespalib/src/tests/portal/reactor/reactor_test.cpp +++ b/vespalib/src/tests/portal/reactor/reactor_test.cpp @@ -1,14 +1,11 @@ // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/test_kit.h> +#include <vespa/vespalib/testkit/time_bomb.h> #include <vespa/vespalib/net/socket_handle.h> #include <vespa/vespalib/net/socket_utils.h> #include <vespa/vespalib/portal/reactor.h> #include <vespa/vespalib/util/gate.h> - -#include <thread> -#include <chrono> - #include <sys/types.h> #include <sys/socket.h> #include <fcntl.h> @@ -150,9 +147,9 @@ TEST_MT_FFFF("require that reactor token destruction waits for io event handling if (thread_id == 0) { f2.enter_callback.await(); TEST_BARRIER(); // #1 - EXPECT_TRUE(!f3.await(20)); + EXPECT_TRUE(!f3.await(20ms)); f2.exit_callback.countDown(); - EXPECT_TRUE(f3.await(60000)); + EXPECT_TRUE(f3.await(60s)); } else { TEST_BARRIER(); // #1 f2.token.reset(); |