mirror of https://github.com/borgbackup/borg.git
remote: Test that the legacy free rpc bootstrap works.
This commit is contained in:
parent
bd3a4a2f92
commit
8955d8bb2a
|
@ -431,6 +431,9 @@ class RemoteRepository:
|
||||||
def required_version(self):
|
def required_version(self):
|
||||||
return self.args[1]
|
return self.args[1]
|
||||||
|
|
||||||
|
# If compatibility with 1.0.x is not longer needed, replace all checks of this with True and simplify the code
|
||||||
|
dictFormat = False # outside of __init__ for testing of legacy free protocol
|
||||||
|
|
||||||
def __init__(self, location, create=False, exclusive=False, lock_wait=None, lock=True, append_only=False, args=None):
|
def __init__(self, location, create=False, exclusive=False, lock_wait=None, lock=True, append_only=False, args=None):
|
||||||
self.location = self._location = location
|
self.location = self._location = location
|
||||||
self.preload_ids = []
|
self.preload_ids = []
|
||||||
|
@ -442,7 +445,6 @@ class RemoteRepository:
|
||||||
self.ratelimit = SleepingBandwidthLimiter(args.remote_ratelimit * 1024 if args and args.remote_ratelimit else 0)
|
self.ratelimit = SleepingBandwidthLimiter(args.remote_ratelimit * 1024 if args and args.remote_ratelimit else 0)
|
||||||
|
|
||||||
self.unpacker = msgpack.Unpacker(use_list=False)
|
self.unpacker = msgpack.Unpacker(use_list=False)
|
||||||
self.dictFormat = False
|
|
||||||
self.server_version = parse_version('1.0.8') # fallback version if server is too old to send version information
|
self.server_version = parse_version('1.0.8') # fallback version if server is too old to send version information
|
||||||
self.p = None
|
self.p = None
|
||||||
testing = location.host == '__testsuite__'
|
testing = location.host == '__testsuite__'
|
||||||
|
|
|
@ -723,6 +723,31 @@ class RemoteRepositoryTestCase(RepositoryTestCase):
|
||||||
assert self.repository.borg_cmd(args, testing=False) == ['borg-0.28.2', 'serve', '--umask=077', '--info']
|
assert self.repository.borg_cmd(args, testing=False) == ['borg-0.28.2', 'serve', '--umask=077', '--info']
|
||||||
|
|
||||||
|
|
||||||
|
class RemoteLegacyFree(RepositoryTestCaseBase):
|
||||||
|
# Keep testing this so we can someday safely remove the legacy tuple format.
|
||||||
|
|
||||||
|
def open(self, create=False):
|
||||||
|
with patch.object(RemoteRepository, 'dictFormat', True):
|
||||||
|
return RemoteRepository(Location('__testsuite__:' + os.path.join(self.tmppath, 'repository')),
|
||||||
|
exclusive=True, create=create)
|
||||||
|
|
||||||
|
def test_legacy_free(self):
|
||||||
|
# put
|
||||||
|
self.repository.put(H(0), b'foo')
|
||||||
|
self.repository.commit()
|
||||||
|
self.repository.close()
|
||||||
|
# replace
|
||||||
|
self.repository = self.open()
|
||||||
|
with self.repository:
|
||||||
|
self.repository.put(H(0), b'bar')
|
||||||
|
self.repository.commit()
|
||||||
|
# delete
|
||||||
|
self.repository = self.open()
|
||||||
|
with self.repository:
|
||||||
|
self.repository.delete(H(0))
|
||||||
|
self.repository.commit()
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(sys.platform == 'cygwin', reason='remote is broken on cygwin and hangs')
|
@pytest.mark.skipif(sys.platform == 'cygwin', reason='remote is broken on cygwin and hangs')
|
||||||
class RemoteRepositoryCheckTestCase(RepositoryCheckTestCase):
|
class RemoteRepositoryCheckTestCase(RepositoryCheckTestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue