-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add to sync documentation - Remove hyperthreading in sync command, and explicitly add a default walltime - Raise error when sync path is not defined - Remove sync ssh keys - Add flag for syncing uncollated files which defaults to True when collation is enabled.
- Loading branch information
Jo Basevi
committed
Nov 1, 2023
1 parent
202e45f
commit 472b9f9
Showing
5 changed files
with
109 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,35 +184,65 @@ def test_restarts_to_sync(add_config, envt_vars, | |
del os.environ[envt_var] | ||
|
||
|
||
def test_rsync_components(): | ||
def test_set_destination_path(): | ||
additional_config = { | ||
"sync": { | ||
"rsync_flags": "--compress", | ||
"rsync_protocol": 29, | ||
"url": "test.domain", | ||
"user": "test-usr", | ||
"path": "remote/path", | ||
"exclude": ["iceh.????-??-??.nc", "*-DEPRECATED"] | ||
}} | ||
sync = setup_sync(additional_config=additional_config) | ||
|
||
# Test base_rsync_cmd | ||
sync.set_base_rsync_cmd() | ||
|
||
home_path = os.getenv('HOME') | ||
expected_cmd = ('rsync -vrltoD --safe-links --compress --protocol=29' | ||
f' -e "ssh -i {home_path}/.ssh/id_rsa_file_transfer"') | ||
|
||
assert sync.base_rsync_cmd == expected_cmd | ||
|
||
# Test destination_path | ||
sync.set_destination_path() | ||
assert sync.destination_path == "[email protected]:remote/path" | ||
|
||
# Test excludes | ||
# Test value error raised when path is not set | ||
sync = setup_sync(additional_config={}) | ||
with pytest.raises(ValueError): | ||
sync.set_destination_path() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"add_config, expected_excludes", | ||
[ | ||
( | ||
{ | ||
"sync": { | ||
"exclude": ["iceh.????-??-??.nc", "*-DEPRECATED"] | ||
}, | ||
"collate": { | ||
"enable": True | ||
} | ||
}, ("--exclude iceh.????-??-??.nc --exclude *-DEPRECATED" | ||
" --exclude *.nc.*") | ||
), | ||
( | ||
{ | ||
"sync": { | ||
"exclude_uncollated": False | ||
}, | ||
"collate": { | ||
"enable": True | ||
} | ||
}, "" | ||
), | ||
( | ||
{ | ||
"sync": { | ||
"exclude": "*-DEPRECATED" | ||
}, | ||
"collate": { | ||
"enable": False | ||
} | ||
}, "--exclude *-DEPRECATED" | ||
) | ||
]) | ||
def test_set_excludes_flags(add_config, expected_excludes): | ||
sync = setup_sync(additional_config=add_config) | ||
|
||
# Test setting excludes | ||
sync.set_excludes_flags() | ||
expected_excludes = "--exclude iceh.????-??-??.nc --exclude *-DEPRECATED" | ||
expected_excludes += " --exclude *.nc.*" | ||
assert sync.excludes == expected_excludes | ||
|
||
|
||
|