18 #include <gtest/gtest.h> 20 using namespace folly;
28 numConnections_ = numConnections;
39 const uint64_t activeConnectionCountForLoadShedding) {
40 activeConnectionCountForLoadShedding_ =
41 activeConnectionCountForLoadShedding;
45 const uint64_t connectionCountForLoadShedding) {
46 connectionCountForLoadShedding_ = connectionCountForLoadShedding;
49 using Acceptor::setLoadShedConfig;
50 using Acceptor::canAccept;
54 return connectionCountForLoadShedding_;
57 return activeConnectionCountForLoadShedding_;
62 uint64_t activeConnectionCountForLoadShedding_{0};
68 acceptor_.setLoadShedConfig(loadShedConfig_, &connectionCounter_);
73 std::shared_ptr<LoadShedConfiguration> loadShedConfig_ =
74 std::make_shared<LoadShedConfiguration>();
79 acceptor_.setLoadShedConfig(loadShedConfig_,
nullptr);
86 connectionCounter_.setMaxConnections(0);
92 connectionCounter_.setNumConnections(100);
93 connectionCounter_.setMaxConnections(200);
99 connectionCounter_.setNumConnections(300);
100 connectionCounter_.setMaxConnections(200);
101 acceptor_.setConnectionCountForLoadShedding(300);
102 loadShedConfig_->setMaxConnections(200);
103 acceptor_.setLoadShedConfig(loadShedConfig_, &connectionCounter_);
110 connectionCounter_.setNumConnections(300);
111 connectionCounter_.setMaxConnections(200);
113 loadShedConfig_->setWhitelistAddrs(addrs);
114 acceptor_.setLoadShedConfig(loadShedConfig_, &connectionCounter_);
122 connectionCounter_.setNumConnections(300);
123 connectionCounter_.setMaxConnections(200);
124 loadShedConfig_->setMaxActiveConnections(100);
125 loadShedConfig_->setMaxConnections(200);
126 acceptor_.setLoadShedConfig(loadShedConfig_, &connectionCounter_);
133 connectionCounter_.setNumConnections(300);
134 connectionCounter_.setMaxConnections(200);
135 loadShedConfig_->setMaxConnections(400);
136 acceptor_.setLoadShedConfig(loadShedConfig_, &connectionCounter_);
137 acceptor_.setActiveConnectionCountForLoadShedding(300);
138 acceptor_.setConnectionCountForLoadShedding(300);
146 connectionCounter_.setNumConnections(300);
147 connectionCounter_.setMaxConnections(200);
148 loadShedConfig_->setMaxActiveConnections(100);
149 loadShedConfig_->setMaxConnections(200);
150 acceptor_.setLoadShedConfig(loadShedConfig_, &connectionCounter_);
151 acceptor_.setActiveConnectionCountForLoadShedding(110);
159 connectionCounter_.setNumConnections(300);
160 connectionCounter_.setMaxConnections(200);
161 loadShedConfig_->setMaxActiveConnections(100);
162 loadShedConfig_->setMaxConnections(200);
163 acceptor_.setLoadShedConfig(loadShedConfig_, &connectionCounter_);
164 acceptor_.setConnectionCountForLoadShedding(210);
172 connectionCounter_.setNumConnections(300);
173 connectionCounter_.setMaxConnections(200);
174 loadShedConfig_->setMaxActiveConnections(100);
175 loadShedConfig_->setMaxConnections(200);
176 acceptor_.setLoadShedConfig(loadShedConfig_, &connectionCounter_);
177 acceptor_.setActiveConnectionCountForLoadShedding(110);
178 acceptor_.setConnectionCountForLoadShedding(210);
void setActiveConnectionCountForLoadShedding(const uint64_t activeConnectionCountForLoadShedding)
—— Concurrent Priority Queue Implementation ——
TestableAcceptor(const ServerSocketConfig &accConfig)
void setNumConnections(const uint64_t numConnections)
FizzServerAcceptor * acceptor_
uint64_t getConnectionCountForLoadShedding() const override
std::set< folly::SocketAddress, AddressOnlyCompare > AddressSet
SimpleConnectionCounterForTest connectionCounter_
void setConnectionCountForLoadShedding(const uint64_t connectionCountForLoadShedding)
TEST_F(AsyncSSLSocketWriteTest, write_coalescing1)
#define EXPECT_TRUE(condition)
#define EXPECT_FALSE(condition)
~TestableAcceptor() override
uint64_t getActiveConnectionCountForLoadShedding() const override