mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-23 23:02:25 +00:00
Make sure (immutable) test vectors are run with the segment size that was used
to generate them.
This commit is contained in:
parent
af53f5b8b9
commit
921a2083dc
@ -36,7 +36,8 @@ async def test_capability(reactor, request, alice, case, expected):
|
|||||||
computed value.
|
computed value.
|
||||||
"""
|
"""
|
||||||
# rewrite alice's config to match params and convergence
|
# rewrite alice's config to match params and convergence
|
||||||
await reconfigure(reactor, request, alice, (1, case.params.required, case.params.total), case.convergence)
|
await reconfigure(
|
||||||
|
reactor, request, alice, (1, case.params.required, case.params.total), case.convergence, case.segment_size)
|
||||||
|
|
||||||
# upload data in the correct format
|
# upload data in the correct format
|
||||||
actual = upload(alice, case.fmt, case.data)
|
actual = upload(alice, case.fmt, case.data)
|
||||||
|
@ -46,6 +46,7 @@ from allmydata.util.configutil import (
|
|||||||
write_config,
|
write_config,
|
||||||
)
|
)
|
||||||
from allmydata import client
|
from allmydata import client
|
||||||
|
from allmydata.interfaces import DEFAULT_MAX_SEGMENT_SIZE
|
||||||
|
|
||||||
import pytest_twisted
|
import pytest_twisted
|
||||||
|
|
||||||
@ -729,7 +730,10 @@ def upload(alice: TahoeProcess, fmt: CHK | SSK, data: bytes) -> str:
|
|||||||
return cli(*argv).decode("utf-8").strip()
|
return cli(*argv).decode("utf-8").strip()
|
||||||
|
|
||||||
|
|
||||||
async def reconfigure(reactor, request, node: TahoeProcess, params: tuple[int, int, int], convergence: None | bytes) -> None:
|
async def reconfigure(reactor, request, node: TahoeProcess,
|
||||||
|
params: tuple[int, int, int],
|
||||||
|
convergence: None | bytes,
|
||||||
|
max_segment_size: None | int = None) -> None:
|
||||||
"""
|
"""
|
||||||
Reconfigure a Tahoe-LAFS node with different ZFEC parameters and
|
Reconfigure a Tahoe-LAFS node with different ZFEC parameters and
|
||||||
convergence secret.
|
convergence secret.
|
||||||
@ -769,6 +773,16 @@ async def reconfigure(reactor, request, node: TahoeProcess, params: tuple[int, i
|
|||||||
changed = True
|
changed = True
|
||||||
config.write_private_config("convergence", base32.b2a(convergence))
|
config.write_private_config("convergence", base32.b2a(convergence))
|
||||||
|
|
||||||
|
if max_segment_size is not None:
|
||||||
|
cur_segment_size = int(config.get_config("client", "shares._max_immutable_segment_size_for_testing", DEFAULT_MAX_SEGMENT_SIZE))
|
||||||
|
if cur_segment_size != max_segment_size:
|
||||||
|
changed = True
|
||||||
|
config.set_config(
|
||||||
|
"client",
|
||||||
|
"shares._max_immutable_segment_size_for_testing",
|
||||||
|
str(max_segment_size)
|
||||||
|
)
|
||||||
|
|
||||||
if changed:
|
if changed:
|
||||||
# restart the node
|
# restart the node
|
||||||
print(f"Restarting {node.node_dir} for ZFEC reconfiguration")
|
print(f"Restarting {node.node_dir} for ZFEC reconfiguration")
|
||||||
|
@ -88,6 +88,7 @@ _client_config = configutil.ValidConfiguration(
|
|||||||
"shares.happy",
|
"shares.happy",
|
||||||
"shares.needed",
|
"shares.needed",
|
||||||
"shares.total",
|
"shares.total",
|
||||||
|
"shares._max_immutable_segment_size_for_testing",
|
||||||
"storage.plugins",
|
"storage.plugins",
|
||||||
),
|
),
|
||||||
"storage": (
|
"storage": (
|
||||||
@ -896,6 +897,13 @@ class _Client(node.Node, pollmixin.PollMixin):
|
|||||||
DEP["k"] = int(self.config.get_config("client", "shares.needed", DEP["k"]))
|
DEP["k"] = int(self.config.get_config("client", "shares.needed", DEP["k"]))
|
||||||
DEP["n"] = int(self.config.get_config("client", "shares.total", DEP["n"]))
|
DEP["n"] = int(self.config.get_config("client", "shares.total", DEP["n"]))
|
||||||
DEP["happy"] = int(self.config.get_config("client", "shares.happy", DEP["happy"]))
|
DEP["happy"] = int(self.config.get_config("client", "shares.happy", DEP["happy"]))
|
||||||
|
# At the moment this is only used for testing, thus the janky config
|
||||||
|
# attribute name.
|
||||||
|
DEP["max_segment_size"] = int(self.config.get_config(
|
||||||
|
"client",
|
||||||
|
"shares._max_immutable_segment_size_for_testing",
|
||||||
|
DEP["max_segment_size"])
|
||||||
|
)
|
||||||
|
|
||||||
# for the CLI to authenticate to local JSON endpoints
|
# for the CLI to authenticate to local JSON endpoints
|
||||||
self._create_auth_token()
|
self._create_auth_token()
|
||||||
|
Loading…
Reference in New Issue
Block a user