Fix end-to-end tests.

This commit is contained in:
Dan Helfman 2022-08-21 23:29:13 -07:00
parent 3be99de5b1
commit ef7e95e22a
3 changed files with 7 additions and 8 deletions

View file

@ -41,7 +41,7 @@ properties:
service file to the ReadWritePaths list. service file to the ReadWritePaths list.
example: example:
- ssh://user@backupserver/./sourcehostname.borg - ssh://user@backupserver/./sourcehostname.borg
- ssh://user@backupserver/./{fqdn}" - ssh://user@backupserver/./{fqdn}
- /var/local/backups/local.borg - /var/local/backups/local.borg
working_directory: working_directory:
type: string type: string

View file

@ -18,8 +18,9 @@ def generate_configuration(config_path, repository_path):
config = ( config = (
open(config_path) open(config_path)
.read() .read()
.replace('user@backupserver:sourcehostname.borg', repository_path) .replace('ssh://user@backupserver/./sourcehostname.borg', repository_path)
.replace('- user@backupserver:{fqdn}', '') .replace('- ssh://user@backupserver/./{fqdn}', '')
.replace('- /var/local/backups/local.borg', '')
.replace('- /home/user/path with spaces', '') .replace('- /home/user/path with spaces', '')
.replace('- /home', '- {}'.format(config_path)) .replace('- /home', '- {}'.format(config_path))
.replace('- /etc', '') .replace('- /etc', '')

View file

@ -16,8 +16,9 @@ def generate_configuration(config_path, repository_path):
config = ( config = (
open(config_path) open(config_path)
.read() .read()
.replace('user@backupserver:sourcehostname.borg', repository_path) .replace('ssh://user@backupserver/./sourcehostname.borg', repository_path)
.replace('- user@backupserver:{fqdn}', '') .replace('- ssh://user@backupserver/./{fqdn}', '')
.replace('- /var/local/backups/local.borg', '')
.replace('- /home/user/path with spaces', '') .replace('- /home/user/path with spaces', '')
.replace('- /home', '- {}'.format(config_path)) .replace('- /home', '- {}'.format(config_path))
.replace('- /etc', '') .replace('- /etc', '')
@ -32,11 +33,8 @@ def generate_configuration(config_path, repository_path):
def test_override_get_normalized(): def test_override_get_normalized():
temporary_directory = tempfile.mkdtemp() temporary_directory = tempfile.mkdtemp()
repository_path = os.path.join(temporary_directory, 'test.borg') repository_path = os.path.join(temporary_directory, 'test.borg')
extract_path = os.path.join(temporary_directory, 'extract')
original_working_directory = os.getcwd() original_working_directory = os.getcwd()
os.mkdir(extract_path)
os.chdir(extract_path)
try: try:
config_path = os.path.join(temporary_directory, 'test.yaml') config_path = os.path.join(temporary_directory, 'test.yaml')