proxygen
MultiFilePollerTest Class Reference
Inheritance diagram for MultiFilePollerTest:
testing::Test

Public Member Functions

void SetUp () override
 
void delayedWrite (const std::string &path, const std::string &data)
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 

Protected Attributes

std::unique_ptr< MultiFilePollerupdater_
 
std::string tmpdirPath_
 
TemporaryDirectory tmpdir_ {"MultiFilePollerTest"}
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void TearDown ()
 

Detailed Description

Definition at line 38 of file MultiFilePollerTest.cpp.

Member Function Documentation

void MultiFilePollerTest::delayedWrite ( const std::string path,
const std::string data 
)
inline

Definition at line 45 of file MultiFilePollerTest.cpp.

References ASSERT_TRUE, kWriteWaitMs, folly::makeFuture(), folly::detail::distributed_mutex::wait(), and folly::writeFile().

45  {
46  // The delay makes sure mtime (in granularity of sec) of the modified
47  // file is increased by at least 1. Otherwise wangle::FilePoller may not
48  // detect the change.
50  .delayed(kWriteWaitMs)
51  .thenValue(
52  [&](auto&&) { ASSERT_TRUE(folly::writeFile(data, path.c_str())); })
53  .wait();
54  }
bool wait(Waiter *waiter, bool shouldSleep, Waiter *&next)
bool writeFile(const Container &data, const char *filename, int flags=O_WRONLY|O_CREAT|O_TRUNC, mode_t mode=0666)
Definition: FileUtil.h:211
static const std::chrono::milliseconds kWriteWaitMs
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
static constexpr uint64_t data[1]
Definition: Fingerprint.cpp:43
Future< typename std::decay< T >::type > makeFuture(T &&t)
Definition: Future-inl.h:1310
void MultiFilePollerTest::SetUp ( )
inlineoverridevirtual

Reimplemented from testing::Test.

Definition at line 40 of file MultiFilePollerTest.cpp.

References kPollIntervalMs.

40  {
42  tmpdirPath_ = folly::fs::canonical(tmpdir_.path()).string();
43  }
static const std::chrono::milliseconds kPollIntervalMs
TemporaryDirectory tmpdir_
std::unique_ptr< MultiFilePoller > updater_
const fs::path & path() const
Definition: TestUtil.h:116

Member Data Documentation

TemporaryDirectory MultiFilePollerTest::tmpdir_ {"MultiFilePollerTest"}
protected

Definition at line 59 of file MultiFilePollerTest.cpp.

std::string MultiFilePollerTest::tmpdirPath_
protected

Definition at line 58 of file MultiFilePollerTest.cpp.

std::unique_ptr<MultiFilePoller> MultiFilePollerTest::updater_
protected

Definition at line 57 of file MultiFilePollerTest.cpp.


The documentation for this class was generated from the following file: