sapling/eden/integration/persistence_test.py
Adam Simpkins a21f0763ba restructure @eden_repo_test decorator to make mypy happy
Summary:
Update the eden_repo_test decorator so that it no longer automatically adds
`EdenRepoTestBase` as a parent class.  Individual test classes still specify
`EdenRepoTest` as their parent now.

This enables `mypy` to correctly figure out that the individual test classes
derive from `unittest.TestCase`.

This basically does the same thing as D6268258 for the top-level integration
tests.

Reviewed By: wez

Differential Revision: D7459280

fbshipit-source-id: 5d18bd241dad77d55541ac3fa1d169496ffe7003
2018-04-04 17:55:11 -07:00

54 lines
1.9 KiB
Python

#!/usr/bin/env python3
#
# Copyright (c) 2016-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import os
import unittest
from .lib import testcase
@testcase.eden_repo_test
class PersistenceTest(testcase.EdenRepoTest):
def populate_repo(self):
self.repo.write_file('file_in_root', 'contents1')
self.repo.write_file('subdir/file_in_subdir', 'contents2')
self.repo.commit('Initial commit.')
def edenfs_logging_settings(self):
return {'eden.strace': 'DBG7', 'eden.fs.fuse': 'DBG7'}
@unittest.skip('TODO: this is not fully implemented yet')
def test_preserves_inode_numbers_and_timestamps_for_nonmaterialized_inodes_across_restarts(self):
inode_paths = [
'file_in_root',
'subdir', # we care about trees too
'subdir/file_in_subdir',
]
old_stats = [
os.lstat(os.path.join(self.mount, path))
for path in inode_paths]
self.eden.shutdown()
self.eden.start()
new_stats = [
os.lstat(os.path.join(self.mount, path))
for path in inode_paths]
for (path, old_stat, new_stat) in zip(inode_paths, old_stats, new_stats):
self.assertEqual(old_stat.st_ino, new_stat.st_ino,
f"inode numbers must line up for path {path}")
self.assertEqual(old_stat.st_atime, new_stat.st_atime,
f"atime must line up for path {path}")
self.assertEqual(old_stat.st_mtime, new_stat.st_mtime,
f"mtime must line up for path {path}")
self.assertEqual(old_stat.st_ctime, new_stat.st_ctime,
f"ctime must line up for path {path}")