Files
rsync/testsuite/daemon-gzip-upload_test.py
Andrew Tridgell bea8a3a16f testsuite: secure stdio-pipe daemon transport by default, opt-in TCP
Daemon-mode tests default to the stdio-pipe transport (RSYNC_CONNECT_PROG),
which opens no listening socket -- so `make check` never exposes a network
service. Real TCP is opt-in via `runtests.py --use-tcp`, with the daemon
bound to loopback (127.0.0.1) on a claim_ports()-reserved port; CI runs the
suite both ways.

start_test_daemon() is the single seam every daemon test uses: the secure
pipe by default, a real rsyncd on a claimed loopback port under --use-tcp.
Tests with no pipe equivalent (the fake-proxy listener and the reverse-DNS
hostname-ACL daemon test) are gated behind require_tcp().

`make check` also now runs the suite in parallel by default (CHECK_J=8);
the claim_ports() byte-range locks make that safe across concurrent runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-22 14:34:52 +10:00

30 lines
825 B
Python

#!/usr/bin/env python3
# Python rewrite of testsuite/daemon-gzip-upload.test.
#
# Upload a file tree over a compressed connection to a test daemon.
# Exercises (exorcises?) a bug in 2.5.3 that mis-handled doubly-compressed
# transfers. Uses the secure stdio-pipe transport by default; --use-tcp
# runs it against a real loopback rsyncd.
from rsyncfns import (
CHKDIR, FROMDIR, TODIR,
build_rsyncd_conf, checkit, hands_setup, run_rsync, start_test_daemon,
)
DAEMON_PORT = 12880
conf = build_rsyncd_conf()
hands_setup()
# chkdir: vanilla copy minus the daemon's global "foobar.baz" exclude.
run_rsync('-av', '--exclude=foobar.baz', f'{FROMDIR}/', f'{CHKDIR}/')
url = start_test_daemon(conf, DAEMON_PORT)
checkit(
['-avvvvzz', f'{FROMDIR}/', f'{url}test-to/'],
CHKDIR, TODIR,
allowed_codes=(0, 23),
)