mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
Do an upload and download.
This commit is contained in:
parent
9ee10af884
commit
31624019be
@ -1,7 +1,40 @@
|
||||
"""Benchmarks for minimal `tahoe` CLI interactions."""
|
||||
|
||||
def test_cp_one_file(client_node):
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
import pytest
|
||||
|
||||
from integration.util import cli
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def cli_alias(client_node):
|
||||
cli(client_node.process, "create-alias", "cli")
|
||||
|
||||
|
||||
def test_get_put_one_file(client_node, cli_alias, tmp_path):
|
||||
"""
|
||||
Upload a file with tahoe cp and then download it, measuring the latency of
|
||||
both operations.
|
||||
Upload a file with ``tahoe put`` and then download it with ``tahoe get``,
|
||||
measuring the latency of both operations.
|
||||
"""
|
||||
file_size = 1000 # parameterize later on
|
||||
file_path = tmp_path / "file"
|
||||
DATA = b"0123456789" * (file_size // 10)
|
||||
|
||||
with file_path.open("wb") as f:
|
||||
f.write(DATA)
|
||||
cli(client_node.process, "put", str(file_path), "cli:tostdout")
|
||||
|
||||
p = Popen(
|
||||
[
|
||||
"tahoe",
|
||||
"--node-directory",
|
||||
client_node.process.node_dir,
|
||||
"get",
|
||||
"cli:tostdout",
|
||||
"-",
|
||||
],
|
||||
stdout=PIPE,
|
||||
)
|
||||
assert p.stdout.read() == DATA
|
||||
assert p.wait() == 0
|
||||
|
Loading…
Reference in New Issue
Block a user