Skip to content

Commit 92cb3bd

Browse files
committed
Use folly::Init for mock servers to avoid glog warnings
1 parent 183ecd5 commit 92cb3bd

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

mcrouter/lib/network/test/MockMcServer.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
#include <glog/logging.h>
1414

1515
#include <folly/Format.h>
16-
#include <folly/Singleton.h>
16+
#include <folly/init/Init.h>
1717
#include <folly/logging/Init.h>
1818

1919
#include "mcrouter/lib/network/AsyncMcServer.h"
2020
#include "mcrouter/lib/network/AsyncMcServerWorker.h"
21-
#include "mcrouter/lib/network/CarbonMessageDispatcher.h"
2221
#include "mcrouter/lib/network/McServerRequestContext.h"
23-
#include "mcrouter/lib/network/gen/MemcacheMessages.h"
2422
#include "mcrouter/lib/network/gen/MemcacheServer.h"
25-
#include "mcrouter/lib/network/test/MockMc.h"
2623
#include "mcrouter/lib/network/test/MockMcOnRequest.h"
2724

2825
/**
@@ -70,7 +67,7 @@ void serverLoop(
7067
FOLLY_INIT_LOGGING_CONFIG(".=WARNING,folly=INFO; default:async=true");
7168

7269
int main(int argc, char** argv) {
73-
folly::SingletonVault::singleton()->registrationComplete();
70+
folly::Init init(&argc, &argv, folly::InitOptions{}.useGFlags(false).removeFlags(false));
7471

7572
AsyncMcServer::Options opts;
7673
opts.worker.versionString = "MockMcServer-1.0";

mcrouter/lib/network/test/MockMcServerDual.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#include <glog/logging.h>
1414

1515
#include <folly/Format.h>
16-
#include <folly/Singleton.h>
1716
#include <folly/executors/IOThreadPoolExecutor.h>
17+
#include <folly/init/Init.h>
1818
#include <folly/io/async/AsyncSignalHandler.h>
1919
#include <folly/io/async/EventBase.h>
2020
#include <folly/logging/Init.h>
@@ -23,8 +23,6 @@
2323
#include "mcrouter/ExecutorObserver.h"
2424
#include "mcrouter/lib/network/AsyncMcServer.h"
2525
#include "mcrouter/lib/network/AsyncMcServerWorker.h"
26-
#include "mcrouter/lib/network/CarbonMessageDispatcher.h"
27-
#include "mcrouter/lib/network/McServerRequestContext.h"
2826
#include "mcrouter/lib/network/ServerLoad.h"
2927
#include "mcrouter/lib/network/test/MockMcThriftServerHandler.h"
3028

@@ -98,7 +96,7 @@ class ShutdownSignalHandler : public folly::AsyncSignalHandler {
9896
};
9997

10098
int main(int argc, char** argv) {
101-
folly::SingletonVault::singleton()->registrationComplete();
99+
folly::Init init(&argc, &argv, folly::InitOptions{}.useGFlags(false).removeFlags(false));
102100

103101
AsyncMcServer::Options asyncOpts;
104102
asyncOpts.worker.versionString = "MockMcServer-1.0";

mcrouter/lib/network/test/MockMcThriftServer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <glog/logging.h>
1414

1515
#include <folly/Format.h>
16-
#include <folly/Singleton.h>
16+
#include <folly/init/Init.h>
1717
#include <folly/logging/Init.h>
1818
#include <thrift/lib/cpp2/server/ThriftServer.h>
1919

@@ -52,7 +52,7 @@ void sigHandler(int /* signo */) {
5252
}
5353

5454
int main(int argc, char** argv) {
55-
folly::SingletonVault::singleton()->registrationComplete();
55+
folly::Init init(&argc, &argv, folly::InitOptions{}.useGFlags(false).removeFlags(false));
5656

5757
uint16_t port = 0;
5858
int existingSocketFd = 0;

0 commit comments

Comments
 (0)