mirror of
https://github.com/borgbackup/borg.git
synced 2025-03-08 04:44:32 +00:00
give borgstore.Store a complete levels configuration, fixes #8432
also: - add BORG_STORE_DATA_LEVELS=2 env var - use BORG_STORE_DATA_LEVELS=0 to speed up tests
This commit is contained in:
parent
156d33e69c
commit
0d269e7f85
3 changed files with 13 additions and 3 deletions
|
@ -116,9 +116,18 @@ class Repository:
|
|||
url = "file://%s" % os.path.abspath(path_or_location)
|
||||
location = Location(url)
|
||||
self._location = location
|
||||
# use a Store with flat config storage and 2-levels-nested data storage
|
||||
# lots of stuff in data: use 2 levels by default (data/00/00/ .. data/ff/ff/ dirs)!
|
||||
data_levels = int(os.environ.get("BORG_STORE_DATA_LEVELS", "2"))
|
||||
levels_config = {
|
||||
"archives/": [0],
|
||||
"cache/": [0],
|
||||
"config/": [0],
|
||||
"data/": [data_levels],
|
||||
"keys/": [0],
|
||||
"locks/": [0],
|
||||
}
|
||||
try:
|
||||
self.store = Store(url, levels={"config/": [0], "data/": [2]})
|
||||
self.store = Store(url, levels=levels_config)
|
||||
except StoreBackendError as e:
|
||||
raise Error(str(e))
|
||||
self.version = None
|
||||
|
|
|
@ -30,6 +30,7 @@ def clean_env(tmpdir_factory, monkeypatch):
|
|||
monkeypatch.setenv("BORG_BASE_DIR", str(tmpdir_factory.mktemp("borg-base-dir")))
|
||||
# Speed up tests
|
||||
monkeypatch.setenv("BORG_TESTONLY_WEAKEN_KDF", "1")
|
||||
monkeypatch.setenv("BORG_STORE_DATA_LEVELS", "0") # flat storage for few objects
|
||||
|
||||
|
||||
def pytest_report_header(config, start_path):
|
||||
|
|
|
@ -12,7 +12,7 @@ ID2 = "bar", 2, 2
|
|||
|
||||
@pytest.fixture()
|
||||
def lockstore(tmpdir):
|
||||
store = Store("file://" + str(tmpdir / "lockstore"))
|
||||
store = Store("file://" + str(tmpdir / "lockstore"), levels={"locks/": [0]})
|
||||
store.create()
|
||||
with store:
|
||||
yield store
|
||||
|
|
Loading…
Add table
Reference in a new issue