示例#1
0
        async def sync_all_the_files(self):
            # Less than 4 retries causes the following test case to fail:
            # ```python
            # state = FSOnlineConcurrentTreeAndSync()
            # async def steps():
            #     v1 = await state.init()
            #     v2 = await state.register_user_fs1(force_after_init=v1)
            #     v3 = await state.register_user_fs2(force_after_init=v1)
            #     v4 = await state.create_file(fs=v3, name='b', parent=v1)
            #     await state.sync_all_the_files()
            #     await state.update_file(fs=v3, path=v4)
            #     await state.update_file(fs=v2, path=v4)
            #     v5 = await state.create_file(fs=v3, name='a', parent=v1)
            #     v6 = await state.create_file(fs=v3, name='a', parent=v1)
            #     v7 = await state.move_file(dst_name='a', dst_parent=v1, fs=v2, src=v4)
            #     await state.sync_all_the_files()
            #     await state.teardown()
            # state.trio_run(steps)
            # ```
            # for fs in [self.user_fs1, self.user_fs2]:
            #     workspace = fs.get_workspace(self.wid)
            retries = 4
            workspace1 = self.user_fs1.get_workspace(self.wid)
            workspace2 = self.user_fs2.get_workspace(self.wid)
            for _ in range(retries):
                await workspace1.sync()
                await workspace2.sync()
                await self.user_fs1.sync()
                await self.user_fs2.sync()

            user_fs_dump_1 = await workspace1.dump()
            user_fs_dump_2 = await workspace2.dump()
            compare_fs_dumps(user_fs_dump_1, user_fs_dump_2)
示例#2
0
        async def sync(self):
            # Send two syncs in a row given file conflict results are not synced
            # once created

            workspace1 = self.user_fs1.get_workspace(self.wid)
            workspace2 = self.user_fs2.get_workspace(self.wid)

            # Sync 1
            await workspace1.sync()
            await self.user_fs1.sync()
            await self.user_fs1.sync()

            # Sync 2
            await workspace2.sync()
            await self.user_fs2.sync()
            await self.user_fs2.sync()

            # Sync 1
            await workspace1.sync()
            await self.user_fs1.sync()

            fs_dump_1 = await workspace1.dump()
            fs_dump_2 = await workspace2.dump()
            compare_fs_dumps(fs_dump_1, fs_dump_2)