def test_open_inode(self):
"""
That the case of a dentry unlinked while a client holds an
inode open is handled correctly.
The inode should be moved into a stray dentry, while the original
dentry and directory should be purged.
The inode's data should be purged when the client eventually closes
it.
"""
mount_a_client_id = self.mount_a.get_global_id()
# Write some bytes to a file
size_mb = 8
self.mount_a.write_n_mb("open_file", size_mb)
open_file_ino = self.mount_a.path_to_ino("open_file")
# Hold the file open
p = self.mount_a.open_background("open_file")
self.assertEqual(self.get_session(mount_a_client_id)['num_caps'], 2)
# Unlink the dentry
self.mount_a.run_shell(["rm", "-f", "open_file"])