diff options
author | Roland Reichwein <mail@reichwein.it> | 2023-02-11 11:00:54 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2023-02-11 11:00:54 +0100 |
commit | 52702a0438e3ba4044cebf14c2d9413a01f967b7 (patch) | |
tree | b0f59300a6fb034cfe9bdcae496d8a283d73537b /tests/test-whiteboard.cpp | |
parent | 468c6989aee4aac5004236144bd5edc1472228bd (diff) |
Test maxconnections
Diffstat (limited to 'tests/test-whiteboard.cpp')
-rw-r--r-- | tests/test-whiteboard.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test-whiteboard.cpp b/tests/test-whiteboard.cpp index e1df17a..b6fe9c5 100644 --- a/tests/test-whiteboard.cpp +++ b/tests/test-whiteboard.cpp @@ -57,6 +57,7 @@ protected: <datapath>.</datapath> <maxage>2592000</maxage> <threads>4</threads> + <maxconnections>3</maxconnections> </config> )CONFIG"); std::error_code ec; @@ -159,6 +160,11 @@ public: { } + bool is_open() + { + return ws_->is_open(); + } + private: boost::asio::io_context ioc_; boost::asio::ip::tcp::resolver::results_type resolver_results_; @@ -200,3 +206,19 @@ TEST_F(WhiteboardTest, threads) ASSERT_GE(Process::number_of_threads(m_pid), 4); } +TEST_F(WhiteboardTest, max_connections) +{ + WebsocketClient wc1; + std::this_thread::sleep_for(std::chrono::milliseconds(20)); + ASSERT_TRUE(wc1.is_open()); + + WebsocketClient wc2; + std::this_thread::sleep_for(std::chrono::milliseconds(20)); + ASSERT_TRUE(wc2.is_open()); + + WebsocketClient wc3; + std::this_thread::sleep_for(std::chrono::milliseconds(20)); + ASSERT_TRUE(wc3.is_open()); + + ASSERT_THROW(WebsocketClient wc4, std::exception); +} |