mirror of
https://github.com/borgbackup/borg.git
synced 2026-06-11 01:41:57 -04:00
Merge pull request #9450 from ThomasWaldmann/more-coverage
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OmniOS, false, omnios, r151056) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
Some checks are pending
Lint / lint (push) Waiting to run
CI / lint (push) Waiting to run
CI / security (push) Waiting to run
CI / asan_ubsan (push) Blocked by required conditions
CI / native_tests (push) Blocked by required conditions
CI / vm_tests (Haiku, false, haiku, r1beta5) (push) Blocked by required conditions
CI / vm_tests (NetBSD, false, netbsd, 10.1) (push) Blocked by required conditions
CI / vm_tests (OmniOS, false, omnios, r151056) (push) Blocked by required conditions
CI / vm_tests (OpenBSD, false, openbsd, 7.7) (push) Blocked by required conditions
CI / vm_tests (borg-freebsd-14-x86_64-gh, FreeBSD, true, freebsd, 14.3) (push) Blocked by required conditions
CI / windows_tests (push) Blocked by required conditions
CodeQL / Analyze (push) Waiting to run
tests: add test for cockpit feature
This commit is contained in:
commit
b5471bbe36
1 changed files with 48 additions and 0 deletions
48
src/borg/testsuite/cockpit_test.py
Normal file
48
src/borg/testsuite/cockpit_test.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import asyncio
|
||||
import subprocess
|
||||
|
||||
import pytest
|
||||
|
||||
from borg.platformflags import is_freebsd, is_win32
|
||||
|
||||
try:
|
||||
from borg.cockpit.app import BorgCockpitApp
|
||||
|
||||
have_cockpit = True
|
||||
except ImportError:
|
||||
have_cockpit = False
|
||||
|
||||
pytestmark = pytest.mark.skipif(not have_cockpit, reason="can not import BorgCockpitApp, is textual installed?")
|
||||
|
||||
|
||||
def test_cockpit_app_create_archive(tmp_path):
|
||||
if not (is_freebsd or is_win32):
|
||||
pytest.skip("this slow test shall only run on FreeBSD and Windows")
|
||||
repo_path = tmp_path / "repo"
|
||||
input_path = tmp_path / "input"
|
||||
input_path.mkdir()
|
||||
for i in range(5000):
|
||||
(input_path / f"test{i}.txt").write_text(f"content {i}")
|
||||
|
||||
subprocess.run(["borg", "-r", str(repo_path), "repo-create", "--encryption", "none"], check=True)
|
||||
|
||||
async def run():
|
||||
app = BorgCockpitApp()
|
||||
app.borg_args = ["-r", str(repo_path), "create", "--list", "test", str(input_path)]
|
||||
|
||||
async with app.run_test() as pilot:
|
||||
assert "BorgBackup" in app.TITLE
|
||||
assert app.is_running
|
||||
|
||||
# Wait for process to finish
|
||||
while getattr(app, "process_running", True):
|
||||
await pilot.pause(0.1)
|
||||
|
||||
status_panel = pilot.app.query_one("#status")
|
||||
assert status_panel.rc == 0
|
||||
|
||||
assert app.total_lines_processed > 0
|
||||
|
||||
await pilot.press("q") # quit app
|
||||
|
||||
asyncio.run(run())
|
||||
Loading…
Reference in a new issue