mirror of https://github.com/borgbackup/borg.git
Merge pull request #5882 from KN4CK3R/master
Forward implement BORG_SELFTEST env variable (#5873)
This commit is contained in:
commit
77ffb083e6
|
@ -78,6 +78,14 @@ General:
|
||||||
- ``pyfuse3``: only try to load pyfuse3
|
- ``pyfuse3``: only try to load pyfuse3
|
||||||
- ``llfuse``: only try to load llfuse
|
- ``llfuse``: only try to load llfuse
|
||||||
- ``none``: do not try to load an implementation
|
- ``none``: do not try to load an implementation
|
||||||
|
BORG_SELFTEST
|
||||||
|
This can be used to influence borg's builtin self-tests. The default is to execute the tests
|
||||||
|
at the beginning of each borg command invocation.
|
||||||
|
|
||||||
|
BORG_SELFTEST=disabled can be used to switch off the tests and rather save some time.
|
||||||
|
Disabling is not recommended for normal borg users, but large scale borg storage providers can
|
||||||
|
use this to optimize production servers after at least doing a one-time test borg (with
|
||||||
|
selftests not disabled) when installing or upgrading machines / OS / borg.
|
||||||
BORG_WORKAROUNDS
|
BORG_WORKAROUNDS
|
||||||
A list of comma separated strings that trigger workarounds in borg,
|
A list of comma separated strings that trigger workarounds in borg,
|
||||||
e.g. to work around bugs in other software.
|
e.g. to work around bugs in other software.
|
||||||
|
|
|
@ -12,8 +12,7 @@ To assert that self test discovery works correctly the number of tests is kept i
|
||||||
variable. SELFTEST_COUNT must be updated if new tests are added or removed to or from any of the tests
|
variable. SELFTEST_COUNT must be updated if new tests are added or removed to or from any of the tests
|
||||||
used here.
|
used here.
|
||||||
"""
|
"""
|
||||||
|
import os
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from unittest import TestResult, TestSuite, defaultTestLoader
|
from unittest import TestResult, TestSuite, defaultTestLoader
|
||||||
|
@ -56,6 +55,9 @@ class SelfTestResult(TestResult):
|
||||||
|
|
||||||
|
|
||||||
def selftest(logger):
|
def selftest(logger):
|
||||||
|
if os.environ.get('BORG_SELFTEST') == 'disabled':
|
||||||
|
logger.debug("borg selftest disabled via BORG_SELFTEST env variable")
|
||||||
|
return
|
||||||
selftest_started = time.perf_counter()
|
selftest_started = time.perf_counter()
|
||||||
result = SelfTestResult()
|
result = SelfTestResult()
|
||||||
test_suite = TestSuite()
|
test_suite = TestSuite()
|
||||||
|
|
|
@ -249,6 +249,7 @@ class ArchiverTestCaseBase(BaseTestCase):
|
||||||
os.environ['BORG_CHECK_I_KNOW_WHAT_I_AM_DOING'] = 'YES'
|
os.environ['BORG_CHECK_I_KNOW_WHAT_I_AM_DOING'] = 'YES'
|
||||||
os.environ['BORG_DELETE_I_KNOW_WHAT_I_AM_DOING'] = 'YES'
|
os.environ['BORG_DELETE_I_KNOW_WHAT_I_AM_DOING'] = 'YES'
|
||||||
os.environ['BORG_PASSPHRASE'] = 'waytooeasyonlyfortests'
|
os.environ['BORG_PASSPHRASE'] = 'waytooeasyonlyfortests'
|
||||||
|
os.environ['BORG_SELFTEST'] = 'disabled'
|
||||||
self.archiver = not self.FORK_DEFAULT and Archiver() or None
|
self.archiver = not self.FORK_DEFAULT and Archiver() or None
|
||||||
self.tmpdir = tempfile.mkdtemp()
|
self.tmpdir = tempfile.mkdtemp()
|
||||||
self.repository_path = os.path.join(self.tmpdir, 'repository')
|
self.repository_path = os.path.join(self.tmpdir, 'repository')
|
||||||
|
|
Loading…
Reference in New Issue