mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 22:07:44 +03:00
add test verifying flush_cache works after a graceful restart
Summary: I kept running into issues trying to get graceful restart and flush_cache to work together in the hg integration suite, so add a test to ensure flush_cache succeeds after a graceful restart in the main integration suite. Also, to make the test's output easier to follow, add logging when invalidating inodes. Reviewed By: simpkins Differential Revision: D8215961 fbshipit-source-id: 33db4292af3969ae23940c3027ba513ed20c53fb
This commit is contained in:
parent
4411b67d52
commit
5b6bb343f0
@ -944,6 +944,7 @@ void EdenServiceHandler::flushStatsNow() {
|
||||
Future<Unit> EdenServiceHandler::future_invalidateKernelInodeCache(
|
||||
std::unique_ptr<std::string> mountPoint,
|
||||
std::unique_ptr<std::string> path) {
|
||||
auto helper = INSTRUMENT_THRIFT_CALL(DBG2, *mountPoint, *path);
|
||||
auto edenMount = server_->getMount(*mountPoint);
|
||||
InodePtr inode;
|
||||
if (path->empty()) {
|
||||
|
@ -233,3 +233,19 @@ class TakeoverTest(testcase.EdenRepoTest):
|
||||
self.assertEqual(inode_number, os.fstat(fd).st_ino)
|
||||
finally:
|
||||
os.close(fd)
|
||||
|
||||
def test_contents_are_the_same_if_handle_is_held_open(self) -> None:
|
||||
with open(os.path.join(self.mount, "tree", "hello")) as c2_hello_file, open(
|
||||
os.path.join(self.mount, "src", "main.c")
|
||||
) as c2_mainc_file:
|
||||
|
||||
self.eden.graceful_restart()
|
||||
self.eden.run_cmd(
|
||||
"debug", "flush_cache", os.path.join("tree", "hello"), cwd=self.mount
|
||||
)
|
||||
self.eden.run_cmd(
|
||||
"debug", "flush_cache", os.path.join("src", "main.c"), cwd=self.mount
|
||||
)
|
||||
|
||||
self.assertEqual(self.page1 + self.page2, c2_hello_file.read())
|
||||
self.assertEqual("hello world v2", c2_mainc_file.read())
|
||||
|
Loading…
Reference in New Issue
Block a user