Skip to content

Commit

Permalink
Use folly::Init for mock servers to avoid glog warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mszabo-wikia committed Jul 31, 2024
1 parent 183ecd5 commit 92cb3bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
7 changes: 2 additions & 5 deletions mcrouter/lib/network/test/MockMcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@
#include <glog/logging.h>

#include <folly/Format.h>
#include <folly/Singleton.h>
#include <folly/init/Init.h>
#include <folly/logging/Init.h>

#include "mcrouter/lib/network/AsyncMcServer.h"
#include "mcrouter/lib/network/AsyncMcServerWorker.h"
#include "mcrouter/lib/network/CarbonMessageDispatcher.h"
#include "mcrouter/lib/network/McServerRequestContext.h"
#include "mcrouter/lib/network/gen/MemcacheMessages.h"
#include "mcrouter/lib/network/gen/MemcacheServer.h"
#include "mcrouter/lib/network/test/MockMc.h"
#include "mcrouter/lib/network/test/MockMcOnRequest.h"

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

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

AsyncMcServer::Options opts;
opts.worker.versionString = "MockMcServer-1.0";
Expand Down
6 changes: 2 additions & 4 deletions mcrouter/lib/network/test/MockMcServerDual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#include <glog/logging.h>

#include <folly/Format.h>
#include <folly/Singleton.h>
#include <folly/executors/IOThreadPoolExecutor.h>
#include <folly/init/Init.h>
#include <folly/io/async/AsyncSignalHandler.h>
#include <folly/io/async/EventBase.h>
#include <folly/logging/Init.h>
Expand All @@ -23,8 +23,6 @@
#include "mcrouter/ExecutorObserver.h"
#include "mcrouter/lib/network/AsyncMcServer.h"
#include "mcrouter/lib/network/AsyncMcServerWorker.h"
#include "mcrouter/lib/network/CarbonMessageDispatcher.h"
#include "mcrouter/lib/network/McServerRequestContext.h"
#include "mcrouter/lib/network/ServerLoad.h"
#include "mcrouter/lib/network/test/MockMcThriftServerHandler.h"

Expand Down Expand Up @@ -98,7 +96,7 @@ class ShutdownSignalHandler : public folly::AsyncSignalHandler {
};

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

AsyncMcServer::Options asyncOpts;
asyncOpts.worker.versionString = "MockMcServer-1.0";
Expand Down
4 changes: 2 additions & 2 deletions mcrouter/lib/network/test/MockMcThriftServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <glog/logging.h>

#include <folly/Format.h>
#include <folly/Singleton.h>
#include <folly/init/Init.h>
#include <folly/logging/Init.h>
#include <thrift/lib/cpp2/server/ThriftServer.h>

Expand Down Expand Up @@ -52,7 +52,7 @@ void sigHandler(int /* signo */) {
}

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

uint16_t port = 0;
int existingSocketFd = 0;
Expand Down

0 comments on commit 92cb3bd

Please sign in to comment.