sapling/eden/fs/testharness/TestServer.h
Katie Mancini 633e4cb6b2 expose startup status on thrift server
Summary:
EdenFS is often started in the background. Because of this users can not easily
see the startup status. The only place it is avaiable other than the eden start
command is the logs. Those are hard to find and not really intended to be easy
to read.

Because users don't see EdenFS making progress while it is starting, users
reachout for help in the support group (leading to the oncall having to read out
the logs to them), or they will try to self service and kill EdenFS which land
themselves in a worse state, and lead to start up taking even longer due to
unclean startup or EdenFS corruption (proxy hashes).

In this diff I am exposing a way to subscribe to the status of EdenFS's startup
process. I also introduce the `--verbose` flag on the `status` command that
displays this startup status when EdenFS is running.

Reviewed By: xavierd

Differential Revision: D38962809

fbshipit-source-id: 2a8f03218df33e4fbfd4d0be919d48d9523c85b8
2023-01-27 15:48:56 -08:00

47 lines
966 B
C++

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This software may be used and distributed according to the terms of the
* GNU General Public License version 2.
*/
#pragma once
#include <memory>
#include <folly/experimental/TestUtil.h>
#include "eden/fs/service/StartupStatusSubscriber.h"
#include "eden/fs/utils/PathFuncs.h"
namespace facebook::eden {
class EdenServer;
/**
* TestServer helps create an EdenServer object for use in unit tests.
*
* It contains a temporary directory object, and an EdenServer.
*/
class TestServer {
public:
TestServer();
~TestServer();
AbsolutePath getTmpDir() const;
EdenServer& getServer() {
return *server_;
}
private:
static std::unique_ptr<EdenServer> createServer(
AbsolutePathPiece tmpDir,
std::shared_ptr<StartupStatusChannel> startStatusChannel);
folly::test::TemporaryDirectory tmpDir_;
std::unique_ptr<EdenServer> server_;
};
} // namespace facebook::eden