mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-24 07:06:41 +00:00
Do multiple files sequentially, to reduce noise.
This commit is contained in:
parent
a497b8d86f
commit
e21c2dd470
@ -7,48 +7,60 @@ import pytest
|
||||
from integration.util import cli
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
@pytest.fixture(scope="module", autouse=True)
|
||||
def cli_alias(client_node):
|
||||
cli(client_node.process, "create-alias", "cli")
|
||||
|
||||
|
||||
@pytest.mark.parametrize("file_size", [1000, 100_000, 1_000_000, 10_000_000])
|
||||
def test_get_put_one_file(
|
||||
def test_get_put_files_sequentially(
|
||||
file_size,
|
||||
client_node,
|
||||
cli_alias,
|
||||
tmp_path,
|
||||
tahoe_benchmarker,
|
||||
number_of_nodes,
|
||||
capsys,
|
||||
):
|
||||
"""
|
||||
Upload a file with ``tahoe put`` and then download it with ``tahoe get``,
|
||||
measuring the latency of both operations.
|
||||
Upload 5 files with ``tahoe put`` and then download them with ``tahoe
|
||||
get``, measuring the latency of both operations. We do multiple uploads
|
||||
and downloads to try to reduce noise.
|
||||
"""
|
||||
file_path = tmp_path / "file"
|
||||
DATA = b"0123456789" * (file_size // 10)
|
||||
with file_path.open("wb") as f:
|
||||
f.write(DATA)
|
||||
|
||||
with tahoe_benchmarker.record(
|
||||
capsys, "cli-put-file", file_size=file_size, number_of_nodes=number_of_nodes
|
||||
):
|
||||
cli(client_node.process, "put", str(file_path), "cli:tostdout")
|
||||
for i in range(5):
|
||||
p = Popen(
|
||||
[
|
||||
"tahoe",
|
||||
"--node-directory",
|
||||
client_node.process.node_dir,
|
||||
"put",
|
||||
"-",
|
||||
f"cli:get_put_files_sequentially{i}",
|
||||
],
|
||||
stdin=PIPE,
|
||||
)
|
||||
p.stdin.write(DATA)
|
||||
p.stdin.write(str(i).encode("ascii"))
|
||||
p.stdin.close()
|
||||
assert p.wait() == 0
|
||||
|
||||
with tahoe_benchmarker.record(
|
||||
capsys, "cli-get-file", file_size=file_size, number_of_nodes=number_of_nodes
|
||||
):
|
||||
p = Popen(
|
||||
[
|
||||
"tahoe",
|
||||
"--node-directory",
|
||||
client_node.process.node_dir,
|
||||
"get",
|
||||
"cli:tostdout",
|
||||
"-",
|
||||
],
|
||||
stdout=PIPE,
|
||||
)
|
||||
assert p.stdout.read() == DATA
|
||||
assert p.wait() == 0
|
||||
for i in range(5):
|
||||
p = Popen(
|
||||
[
|
||||
"tahoe",
|
||||
"--node-directory",
|
||||
client_node.process.node_dir,
|
||||
"get",
|
||||
f"cli:get_put_files_sequentially{i}",
|
||||
"-",
|
||||
],
|
||||
stdout=PIPE,
|
||||
)
|
||||
assert p.stdout.read() == DATA + str(i).encode("ascii")
|
||||
assert p.wait() == 0
|
||||
|
Loading…
Reference in New Issue
Block a user