=========================== short test summary info ============================pub -o AllowUsers=user42 -o PermitRootLogin=yes -o SetEnv=PATH="/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/scripts:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_ostree-push/scripts:/usr/
ERROR tests/test_full.py::test_no_commits - tests.util.OTPushTestError: Could...
ERROR tests/test_full.py::test_basic - tests.util.OTPushTestError: Could not ...
ERROR tests/test_full.py::test_dry_run - tests.util.OTPushTestError: Could no...
ERROR tests/test_full.py::test_scp_dest - tests.util.OTPushTestError: Could n...
ERROR tests/test_full.py::test_command_abspath - tests.util.OTPushTestError: ...
ERROR tests/test_push.py::TestSSHMultiplexer::test_socket_exists - tests.util...
ERROR tests/test_push.py::TestSSHMultiplexer::test_master_non_context - tests...
ERROR tests/test_push.py::TestSSHMultiplexer::test_master_context - tests.uti...
ERROR tests/test_push.py::TestSSHMultiplexer::test_forward_port - tests.util....
ERROR tests/test_push.py::TestSSHMultiplexer::test_run - tests.util.OTPushTes...
ERROR tests/test_push.py::TestPushRefs::test_no_refs - tests.util.OTPushTestE...
ERROR tests/test_push.py::TestPushRefs::test_refs - tests.util.OTPushTestErro...
ERROR tests/test_push.py::TestPushRefs::test_missing_ref - tests.util.OTPushT...
ERROR tests/test_push.py::TestPushRefs::test_summary - tests.util.OTPushTestE...
ERROR tests/test_push.py::TestPushRefs::test_dry_run - tests.util.OTPushTestE...
ERROR tests/test_sshd.py::test_basic - tests.util.OTPushTestError: Could not ...
============ 74 passed, 4 skipped, 19 warnings, 16 errors in 5.91s =============
E: pybuild pybuild:389: test: plugin pyproject failed with: exit code=1: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.12_ostree-push/build; python3.12 -m pytest tests
I: pybuild base:305: cd /<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build; python3.11 -m pytest tests
============================= test session starts ==============================
platform linux -- Python 3.11.8, pytest-8.0.2, pluggy-1.4.0 -- /usr/bin/python3.11
cachedir: .pytest_cache
rootdir: /<<PKGBUILDDIR>>
configfile: pytest.ini
collecting ... collected 94 items
tests/test_full.py::test_no_commits ERROR [ 1%]
tests/test_full.py::test_basic ERROR [ 2%]
tests/test_full.py::test_dry_run ERROR [ 3%]
tests/test_full.py::test_scp_dest ERROR [ 4%]
tests/test_full.py::test_command_abspath ERROR [ 5%]
tests/test_push.py::TestRepoServer::test_missing PASSED [ 6%]
tests/test_push.py::TestRepoServer::test_non_context PASSED [ 7%]
tests/test_push.py::TestRepoServer::test_context PASSED [ 8%]
tests/test_push.py::TestRepoServer::test_pull PASSED [ 9%]
tests/test_push.py::TestSSHMultiplexer::test_socket_exists ERROR [ 10%]
tests/test_push.py::TestSSHMultiplexer::test_master_non_context ERROR [ 11%]
tests/test_push.py::TestSSHMultiplexer::test_master_context ERROR [ 12%]
tests/test_push.py::TestSSHMultiplexer::test_forward_port ERROR [ 13%]
tests/test_push.py::TestSSHMultiplexer::test_run ERROR [ 14%]
tests/test_push.py::TestPushRefs::test_no_refs ERROR [ 15%]
tests/test_push.py::TestPushRefs::test_refs ERROR [ 17%]
tests/test_push.py::TestPushRefs::test_missing_ref ERROR [ 18%]
tests/test_push.py::TestPushRefs::test_summary ERROR [ 19%]
tests/test_push.py::TestPushRefs::test_dry_run ERROR [ 20%]
tests/test_push.py::TestParseDest::test_bad_scheme PASSED [ 21%]
tests/test_push.py::TestParseDest::test_missing_repo PASSED [ 22%]
tests/test_push.py::TestParseDest::test_empty_dest PASSED [ 23%]
tests/test_push.py::TestParseDest::test_missing_host PASSED [ 24%]
tests/test_push.py::TestParseDest::test_invalid_host PASSED [ 25%]
tests/test_push.py::TestParseDest::test_invalid_port PASSED [ 26%]
tests/test_push.py::TestParseDest::test_good_dest PASSED [ 27%]
tests/test_push.py::TestArgParser::test_no_dest PASSED [ 28%]
tests/test_push.py::TestArgParser::test_defaults PASSED [ 29%]
tests/test_push.py::TestArgParser::test_dest PASSED [ 30%]
tests/test_push.py::TestArgParser::test_refs PASSED [ 31%]
tests/test_push.py::TestArgParser::test_port PASSED [ 32%]
tests/test_push.py::TestArgParser::test_port_and_dest_port PASSED [ 34%]
tests/test_push.py::TestArgParser::test_dry_run PASSED [ 35%]
tests/test_push.py::TestArgParser::test_log_level PASSED [ 36%]
tests/test_push.py::TestArgParser::test_repo PASSED [ 37%]
tests/test_push.py::TestArgParser::test_command PASSED [ 38%]
tests/test_push.py::TestArgParser::test_ssh_options PASSED [ 39%]
tests/test_receive.py::TestReceiveRepo::test_cleanup PASSED [ 40%]
tests/test_receive.py::TestReceiveRepo::test_missing_repo PASSED [ 41%]
tests/test_receive.py::TestReceiveRepo::test_get_commit_timestamp PASSED [ 42%]
tests/test_receive.py::TestReceiveRepo::test_is_flatpak_repo PASSED [ 43%]
tests/test_receive.py::TestReceiveRepo::test_pull_commits PASSED [ 44%]
tests/test_receive.py::TestReceiveRepo::test_copy_commit PASSED [ 45%]
tests/test_receive.py::TestReceiveRepo::test_receive PASSED [ 46%]
tests/test_receive.py::TestReceiveRepo::test_receive_update PASSED [ 47%]
tests/test_receive.py::TestReceiveRepo::test_receive_update_hook PASSED [ 48%]
tests/test_receive.py::TestReceiveRepo::test_receive_gpg_sign PASSED [ 50%]
tests/test_receive.py::TestReceiveRepo::test_receive_gpg_verify PASSED [ 51%]
tests/test_receive.py::TestReceiveRepo::test_receive_ed25519_sign SKIPPED [ 52%]
tests/test_receive.py::TestReceiveRepo::test_receive_ed25519_verify SKIPPED [ 53%]
tests/test_receive.py::TestReceiveRepo::test_update_repo_metadata PASSED [ 54%]
tests/test_receive.py::TestReceiveRepo::test_update_repo_metadata_flatpak PASSED [ 55%]
tests/test_receive.py::TestReceiveRepo::test_update_repo_metadata_gpg_sign PASSED [ 56%]
tests/test_receive.py::TestReceiveRepo::test_update_repo_metadata_ed25519_sign SKIPPED [ 57%]
tests/test_receive.py::TestReceiveRepo::test_update_repo_hook PASSED [ 58%]
tests/test_receive.py::TestReceiveRepo::test_receive_missing PASSED [ 59%]
tests/test_receive.py::TestReceiveRepo::test_receive_specific PASSED [ 60%]
tests/test_receive.py::TestReceiveRepo::test_receive_all PASSED [ 61%]
tests/test_receive.py::TestReceiveRepo::test_receive_dry_run PASSED [ 62%]
tests/test_receive.py::TestReceiveRepo::test_receive_force PASSED [ 63%]
tests/test_receive.py::TestReceiver::test_default_config PASSED [ 64%]
tests/test_receive.py::TestReceiver::test_receive PASSED [ 65%]
tests/test_receive.py::TestRepoConfig::test_defaults PASSED [ 67%]
tests/test_receive.py::TestRepoConfig::test_required PASSED [ 68%]
tests/test_receive.py::TestConfig::test_defaults PASSED [ 69%]
tests/test_receive.py::TestConfig::test_invalid PASSED [ 70%]
tests/test_receive.py::TestConfig::test_default_paths PASSED [ 71%]
tests/test_receive.py::TestConfig::test_load_valid PASSED [ 72%]
tests/test_receive.py::TestConfig::test_load_none PASSED [ 73%]
tests/test_receive.py::TestConfig::test_load_empty PASSED [ 74%]
tests/test_receive.py::TestConfig::test_load_missing PASSED [ 75%]
tests/test_receive.py::TestConfig::test_load_multiple PASSED [ 76%]
tests/test_receive.py::TestConfig::test_load_unknown PASSED [ 77%]
tests/test_receive.py::TestConfig::test_load_invalid PASSED [ 78%]
tests/test_receive.py::TestConfig::test_load_env PASSED [ 79%]
tests/test_receive.py::TestConfig::test_load_args PASSED [ 80%]
tests/test_receive.py::TestConfig::test_load_args_invalid PASSED [ 81%]
tests/test_receive.py::TestConfig::test_load_conf_and_args PASSED [ 82%]
tests/test_receive.py::TestConfig::test_repo_config PASSED [ 84%]
tests/test_receive.py::TestArgParser::test_no_repo PASSED [ 85%]
tests/test_receive.py::TestArgParser::test_no_url PASSED [ 86%]
tests/test_receive.py::TestArgParser::test_defaults PASSED [ 87%]
tests/test_receive.py::TestArgParser::test_refs PASSED [ 88%]
tests/test_receive.py::TestArgParser::test_update PASSED [ 89%]
tests/test_receive.py::TestArgParser::test_dry_run PASSED [ 90%]
tests/test_receive.py::TestArgParser::test_force PASSED [ 91%]
tests/test_receive.py::TestArgParser::test_log_level PASSED [ 92%]
tests/test_receive_shell.py::test_command_args PASSED [ 93%]
tests/test_receive_shell.py::test_auto_path PASSED [ 94%]
tests/test_receive_shell.py::test_no_interactive PASSED [ 95%]
tests/test_receive_shell.py::test_wrong_args PASSED [ 96%]
tests/test_receive_shell.py::test_bad_command PASSED [ 97%]
tests/test_receive_shell.py::test_exec_errors SKIPPED (cannot test c...) [ 98%]
tests/test_sshd.py::test_basic ERROR [100%]
==================================== ERRORS ====================================
______________________ ERROR at setup of test_no_commits _______________________
ssh_datadir = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0') cli_env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@pytest.fixture(scope='session')
def sshd(ssh_datadir, cli_env_vars):
sshd_config = ssh_datadir / 'sshd_config'
host_key = ssh_datadir / 'host_rsa_key'
authorized_keys = ssh_datadir / 'id_rsa.pub'
with ssh_server(sshd_config, host_key, authorized_keys, cli_env_vars) \as server_info:
tests/conftest.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/contextlib.py:137: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sshd_config = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/sshd_config')
host_key = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/host_rsa_key') authorized_keys = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/id_rsa.pub')
env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@contextmanager
def ssh_server(sshd_config, host_key, authorized_keys, env_vars=None):
# Running sshd requires an absolute path
sshd = get_sshd()
if not sshd:
raise OTPushTestError('Could not find sshd')
if not have_required_sshd(sshd):
raise OTPushTestError(f'{sshd} is not the required version')
# Build a SetEnv option value from the provided environment variables.
env_vars = env_vars or {}
setenv = ' '.join([
f'{var}="{value}"'
for var, value in env_vars.items()
])
cmd = [
sshd,
# Don't fork
'-D',
# Write logs to stderr
'-e',
# Config file
'-f', str(sshd_config),
# Host key file
'-h', str(host_key),
# Authorized keys file
'-o', f'AuthorizedKeysFile={authorized_keys}',
# Only allow running user
'-o', f'AllowUsers={getpass.getuser()}',
# Allow root login
'-o', 'PermitRootLogin=yes',
# Set environment variables for the process
'-o', f'SetEnv={setenv}',
]
logger.debug('SSH server args: %s', ' '.join(cmd))
# Loop a few times trying to find an open ephemeral port
with open('/proc/sys/net/ipv4/ip_local_port_range') as f:
start_port, stop_port = map(int, f.readline().split())
proc = None
try:
for _ in range(5):
port = random.randrange(start_port, stop_port)
logger.debug('Starting %s with port %d', sshd, port)
proc = subprocess.Popen(cmd + ['-p', str(port)])
server_id = get_ssh_server_id(('127.0.0.1', port))
if server_id.startswith('SSH-2.0-'):
logger.info('%s started on port %d', sshd, port)
break
else:
raise OTPushTestError(f'Could not start {sshd}')E tests.util.OTPushTestError: Could not start /usr/sbin/sshd
tests/util.py:352: OTPushTestError
---------------------------- Captured stderr setup -----------------------------
Server listening on 127.0.0.1 port 32912.
Server listening on 127.0.0.1 port 45749.
------------------------------ Captured log setup ------------------------------
DEBUG tests.util:util.py:200 Found sshd /usr/sbin/sshd
DEBUG tests.util:util.py:231 sshd version line: OpenSSH_9.6p1 Debian-5, OpenSSL 3.1.5 30 Jan 2024
DEBUG tests.util:util.py:259 Detected OpenSSH sshd version 9.6
DEBUG tests.util:util.py:336 SSH server args: /usr/sbin/sshd -D -e -f /tmp/pytest-of-user42/pytest-5/ssh-data0/sshd_config -h /tmp/pytest-of-user42/pytest-5/ssh-data0/host_rsa_key -o AuthorizedKeysFile=/tmp/pytest-of-user42/pytest-5/ssh-data0/id_rsa.
DEBUG tests.util:util.py:345 Starting /usr/sbin/sshd with port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:286 Could not connect to port 32912
DEBUG tests.util:util.py:289 Could not connect in 5 attempts
DEBUG tests.util:util.py:345 Starting /usr/sbin/sshd with port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:286 Could not connect to port 45749
DEBUG tests.util:util.py:289 Could not connect in 5 attempts
DEBUG tests.util:util.py:345 Starting /usr/sbin/sshd with port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:286 Could not connect to port 40901
DEBUG tests.util:util.py:289 Could not connect in 5 attempts
DEBUG tests.util:util.py:345 Starting /usr/sbin/sshd with port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:286 Could not connect to port 35963
DEBUG tests.util:util.py:289 Could not connect in 5 attempts
DEBUG tests.util:util.py:345 Starting /usr/sbin/sshd with port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:286 Could not connect to port 43709
DEBUG tests.util:util.py:289 Could not connect in 5 attempts
DEBUG tests.util:util.py:357 Stopping sshd process 357317 _________________________ ERROR at setup of test_basic _________________________
ssh_datadir = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0') cli_env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@pytest.fixture(scope='session')
def sshd(ssh_datadir, cli_env_vars):
sshd_config = ssh_datadir / 'sshd_config'
host_key = ssh_datadir / 'host_rsa_key'
authorized_keys = ssh_datadir / 'id_rsa.pub'
with ssh_server(sshd_config, host_key, authorized_keys, cli_env_vars) \as server_info:
tests/conftest.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/contextlib.py:137: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sshd_config = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/sshd_config')
host_key = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/host_rsa_key') authorized_keys = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/id_rsa.pub')
env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@contextmanager
def ssh_server(sshd_config, host_key, authorized_keys, env_vars=None):
# Running sshd requires an absolute path
sshd = get_sshd()
if not sshd:
raise OTPushTestError('Could not find sshd')
if not have_required_sshd(sshd):
raise OTPushTestError(f'{sshd} is not the required version')
# Build a SetEnv option value from the provided environment variables.
env_vars = env_vars or {}
setenv = ' '.join([
f'{var}="{value}"'
for var, value in env_vars.items()
])
cmd = [
sshd,
# Don't fork
'-D',
# Write logs to stderr
'-e',
# Config file
'-f', str(sshd_config),
# Host key file
'-h', str(host_key),
# Authorized keys file
'-o', f'AuthorizedKeysFile={authorized_keys}',
# Only allow running user
'-o', f'AllowUsers={getpass.getuser()}',
# Allow root login
'-o', 'PermitRootLogin=yes',
# Set environment variables for the process
'-o', f'SetEnv={setenv}',
]
logger.debug('SSH server args: %s', ' '.join(cmd))
# Loop a few times trying to find an open ephemeral port
with open('/proc/sys/net/ipv4/ip_local_port_range') as f:
start_port, stop_port = map(int, f.readline().split())
proc = None
try:
for _ in range(5):
port = random.randrange(start_port, stop_port)
logger.debug('Starting %s with port %d', sshd, port)
proc = subprocess.Popen(cmd + ['-p', str(port)])
server_id = get_ssh_server_id(('127.0.0.1', port))
if server_id.startswith('SSH-2.0-'):
logger.info('%s started on port %d', sshd, port)
break
else:
raise OTPushTestError(f'Could not start {sshd}')E tests.util.OTPushTestError: Could not start /usr/sbin/sshd
tests/util.py:352: OTPushTestError
________________________ ERROR at setup of test_dry_run ________________________
ssh_datadir = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0') cli_env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@pytest.fixture(scope='session')
def sshd(ssh_datadir, cli_env_vars):
sshd_config = ssh_datadir / 'sshd_config'
host_key = ssh_datadir / 'host_rsa_key'
authorized_keys = ssh_datadir / 'id_rsa.pub'
with ssh_server(sshd_config, host_key, authorized_keys, cli_env_vars) \as server_info:
tests/conftest.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/contextlib.py:137: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sshd_config = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/sshd_config')
host_key = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/host_rsa_key') authorized_keys = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/id_rsa.pub')
env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@contextmanager
def ssh_server(sshd_config, host_key, authorized_keys, env_vars=None):
# Running sshd requires an absolute path
sshd = get_sshd()
if not sshd:
raise OTPushTestError('Could not find sshd')
if not have_required_sshd(sshd):
raise OTPushTestError(f'{sshd} is not the required version')
# Build a SetEnv option value from the provided environment variables.
env_vars = env_vars or {}
setenv = ' '.join([
f'{var}="{value}"'
for var, value in env_vars.items()
])
cmd = [
sshd,
# Don't fork
'-D',
# Write logs to stderr
'-e',
# Config file
'-f', str(sshd_config),
# Host key file
'-h', str(host_key),
# Authorized keys file
'-o', f'AuthorizedKeysFile={authorized_keys}',
# Only allow running user
'-o', f'AllowUsers={getpass.getuser()}',
# Allow root login
'-o', 'PermitRootLogin=yes',
# Set environment variables for the process
'-o', f'SetEnv={setenv}',
]
logger.debug('SSH server args: %s', ' '.join(cmd))
# Loop a few times trying to find an open ephemeral port
with open('/proc/sys/net/ipv4/ip_local_port_range') as f:
start_port, stop_port = map(int, f.readline().split())
proc = None
try:
for _ in range(5):
port = random.randrange(start_port, stop_port)
logger.debug('Starting %s with port %d', sshd, port)
proc = subprocess.Popen(cmd + ['-p', str(port)])
server_id = get_ssh_server_id(('127.0.0.1', port))
if server_id.startswith('SSH-2.0-'):
logger.info('%s started on port %d', sshd, port)
break
else:
raise OTPushTestError(f'Could not start {sshd}')E tests.util.OTPushTestError: Could not start /usr/sbin/sshd
tests/util.py:352: OTPushTestError
_______________________ ERROR at setup of test_scp_dest ________________________
ssh_datadir = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0') cli_env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@pytest.fixture(scope='session')
def sshd(ssh_datadir, cli_env_vars):
sshd_config = ssh_datadir / 'sshd_config'
host_key = ssh_datadir / 'host_rsa_key'
authorized_keys = ssh_datadir / 'id_rsa.pub'
with ssh_server(sshd_config, host_key, authorized_keys, cli_env_vars) \as server_info:
tests/conftest.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/contextlib.py:137: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sshd_config = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/sshd_config')
host_key = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/host_rsa_key') authorized_keys = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/id_rsa.pub')
env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@contextmanager
def ssh_server(sshd_config, host_key, authorized_keys, env_vars=None):
# Running sshd requires an absolute path
sshd = get_sshd()
if not sshd:
raise OTPushTestError('Could not find sshd')
if not have_required_sshd(sshd):
raise OTPushTestError(f'{sshd} is not the required version')
# Build a SetEnv option value from the provided environment variables.
env_vars = env_vars or {}
setenv = ' '.join([
f'{var}="{value}"'
for var, value in env_vars.items()
])
cmd = [
sshd,
# Don't fork
'-D',
# Write logs to stderr
'-e',
# Config file
'-f', str(sshd_config),
# Host key file
'-h', str(host_key),
# Authorized keys file
'-o', f'AuthorizedKeysFile={authorized_keys}',
# Only allow running user
'-o', f'AllowUsers={getpass.getuser()}',
# Allow root login
'-o', 'PermitRootLogin=yes',
# Set environment variables for the process
'-o', f'SetEnv={setenv}',
]
logger.debug('SSH server args: %s', ' '.join(cmd))
# Loop a few times trying to find an open ephemeral port
with open('/proc/sys/net/ipv4/ip_local_port_range') as f:
start_port, stop_port = map(int, f.readline().split())
proc = None
try:
for _ in range(5):
port = random.randrange(start_port, stop_port)
logger.debug('Starting %s with port %d', sshd, port)
proc = subprocess.Popen(cmd + ['-p', str(port)])
server_id = get_ssh_server_id(('127.0.0.1', port))
if server_id.startswith('SSH-2.0-'):
logger.info('%s started on port %d', sshd, port)
break
else:
raise OTPushTestError(f'Could not start {sshd}')E tests.util.OTPushTestError: Could not start /usr/sbin/sshd
tests/util.py:352: OTPushTestError
____________________ ERROR at setup of test_command_abspath ____________________
ssh_datadir = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0') cli_env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@pytest.fixture(scope='session')
def sshd(ssh_datadir, cli_env_vars):
sshd_config = ssh_datadir / 'sshd_config'
host_key = ssh_datadir / 'host_rsa_key'
authorized_keys = ssh_datadir / 'id_rsa.pub'
with ssh_server(sshd_config, host_key, authorized_keys, cli_env_vars) \as server_info:
tests/conftest.py:71:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/usr/lib/python3.11/contextlib.py:137: in __enter__
return next(self.gen)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sshd_config = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/sshd_config')
host_key = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/host_rsa_key') authorized_keys = PosixPath('/tmp/pytest-of-user42/pytest-5/ssh-data0/id_rsa.pub')
env_vars = {'PATH': '/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build/tests:/build/ostree-pus...usr/lib/python3.11/dist-packages:/<<PKGBUILDDIR>>/.pybuild/cpython3_3.11_ostree-push/build'}
@contextmanager
def ssh_server(sshd_config, host_key, authorized_keys, env_vars=None):
# Running sshd requires an absolute path
sshd = get_sshd()
if not sshd:
raise OTPushTestError('Could not find sshd')
if not have_required_sshd(sshd):
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 297 |
Nodes: | 16 (2 / 14) |
Uptime: | 08:55:22 |
Calls: | 6,666 |
Files: | 12,213 |
Messages: | 5,336,260 |