Noisy rsync (#473)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com>
This commit is contained in:
1
changelog/471.bugfix
Normal file
1
changelog/471.bugfix
Normal file
@@ -0,0 +1 @@
|
||||
Fix issue with Rsync reporting in quiet mode.
|
||||
@@ -122,7 +122,7 @@ class NodeManager:
|
||||
|
||||
return {
|
||||
"ignores": ignores,
|
||||
"verbose": getattr(self.config.option, "verbose", False),
|
||||
"verbose": getattr(self.config.option, "verbose", 0),
|
||||
}
|
||||
|
||||
def rsync(self, gateway, source, notify=None, verbose=False, ignores=None):
|
||||
@@ -181,7 +181,7 @@ class HostRSync(execnet.RSync):
|
||||
super().add_target(gateway, remotepath, finishedcallback=finished, delete=True)
|
||||
|
||||
def _report_send_file(self, gateway, modified_rel_path):
|
||||
if self._verbose:
|
||||
if self._verbose > 0:
|
||||
path = os.path.basename(self._sourcedir) + "/" + modified_rel_path
|
||||
remotepath = gateway.spec.chdir
|
||||
print("{}:{} <= {}".format(gateway.spec, remotepath, path))
|
||||
|
||||
@@ -196,6 +196,25 @@ class TestNodeManager:
|
||||
assert dest.join("dir1", "dir2", "hello").check()
|
||||
nodemanager.teardown_nodes()
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"flag, expects_report", [("-q", False), ("", False), ("-v", True)]
|
||||
)
|
||||
def test_rsync_report(
|
||||
self, testdir, mysetup, workercontroller, capsys, flag, expects_report
|
||||
):
|
||||
source, dest = mysetup.source, mysetup.dest
|
||||
dir1 = mysetup.source.mkdir("dir1")
|
||||
args = "--tx", "popen//chdir=%s" % dest, "--rsyncdir", dir1, source
|
||||
if flag:
|
||||
args += (flag,)
|
||||
nodemanager = NodeManager(testdir.parseconfig(*args))
|
||||
nodemanager.setup_nodes(None) # calls .rsync_roots()
|
||||
out, _ = capsys.readouterr()
|
||||
if expects_report:
|
||||
assert "<= pytest/__init__.py" in out
|
||||
else:
|
||||
assert "<= pytest/__init__.py" not in out
|
||||
|
||||
def test_init_rsync_roots(self, testdir, mysetup, workercontroller):
|
||||
source, dest = mysetup.source, mysetup.dest
|
||||
dir2 = source.ensure("dir1", "dir2", dir=1)
|
||||
Reference in New Issue
Block a user