diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ec766998..9129072bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -243,10 +243,10 @@ jobs: # Start ssh-agent and add our key so paramiko can use the agent eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_ed25519 - sudo python3 -m venv /opt/borgstore-venv - sudo /opt/borgstore-venv/bin/pip install -U pip setuptools wheel - sudo /opt/borgstore-venv/bin/pip install "borgstore[rest]" - sudo ln -sf /opt/borgstore-venv/bin/borgstore-server-rest /usr/local/bin/borgstore-server-rest + # The rest test starts "borg serve --rest" over ssh as sftpuser, which runs the borg + # under test from the tox venv under $HOME. Allow sftpuser to traverse into the runner + # home so it can reach that borg (the venv dirs/files are created world-r/x by tox/pip). + sudo chmod o+x "$HOME" # Export SFTP test URL for tox via GITHUB_ENV echo "BORG_TEST_SFTP_REPO=sftp://sftpuser@localhost:22/borg/sftp-repo" >> $GITHUB_ENV echo "BORG_TEST_REST_REPO=rest://sftpuser@localhost:22/borg/rest-repo" >> $GITHUB_ENV diff --git a/src/borg/testsuite/archiver/remote_repo_test.py b/src/borg/testsuite/archiver/remote_repo_test.py index 2374a9436..d91607292 100644 --- a/src/borg/testsuite/archiver/remote_repo_test.py +++ b/src/borg/testsuite/archiver/remote_repo_test.py @@ -2,6 +2,7 @@ import json import os import shutil import subprocess +import sys import pytest @@ -59,9 +60,16 @@ def test_rclone_repo_basics(archiver, tmp_path): @pytest.mark.skipif(not REST_URL, reason="BORG_TEST_REST_REPO not set.") -def test_rest_repo_basics(archiver): +def test_rest_repo_basics(archiver, monkeypatch): create_regular_file(archiver.input_path, "file1", size=100 * 1024) create_regular_file(archiver.input_path, "file2", size=10 * 1024) + # A rest:// repo over ssh starts "borg serve --rest" on the remote. For this test the remote is + # localhost (see CI BORG_TEST_REST_REPO), so point BORG_REMOTE_PATH at the borg under test + # (an absolute path that is valid locally) unless the caller already set it. + if not os.environ.get("BORG_REMOTE_PATH"): + borg_path = shutil.which("borg") or os.path.join(os.path.dirname(sys.executable), "borg") + if os.path.exists(borg_path): + monkeypatch.setenv("BORG_REMOTE_PATH", borg_path) archiver.repository_location = REST_URL archive_name = "test-archive" cmd(archiver, "repo-create", RK_ENCRYPTION)