mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 09:59:19 -04:00
CI: make the rest repo test use "borg serve --rest"
A rest:// repository is now served by "borg serve --rest" spawned over ssh rather than borgstore's "borgstore-server-rest". CI: chmod o+x $HOME so the rest test's ssh user (sftpuser) can run borg The rest repo test starts "borg serve --rest" over ssh as sftpuser, which runs the borg under test from the tox venv under the runner $HOME. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
5415062564
commit
2741265463
2 changed files with 13 additions and 5 deletions
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue