'Pushing a locally-owned volume to a remote volume manager which has a
snapshot in common with the local volume manager results in an
incremental data stream.'

def test_push_with_snapshots(self):

    class FakeVolumeManager(object, ):
        def __init__(self):
            self.written = []
        def snapshots(self, volume):
            return volume.get_filesystem().snapshots()
        @contextmanager
        def receive(self, volume):
            writer = BytesIO()
            (yield writer)
            self.written.append(writer)
    pool = FilesystemStoragePool(FilePath(self.mktemp()))
    service = VolumeService(FilePath(self.mktemp()), pool, reactor=Clock())
    service.startService()
    volume = self.successResultOf(service.create(service.get(MY_VOLUME)))
    filesystem = volume.get_filesystem()
    filesystem.snapshot('stuff')
    remote_manager = FakeVolumeManager()
    self.successResultOf(service.push(volume, remote_manager))
    writer = remote_manager.written.pop()
    self.assertEqual(['incremental    stream    based    on', 'stuff'], writer.getvalue().splitlines()[(-2):])
