summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test-whiteboard.cpp22
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);
+}