Changeset 41067 for trunk/backups/confluence_backup_test.py
- Timestamp:
- Nov 5, 2019, 3:18:35 PM (7 years ago)
- Location:
- trunk/backups
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
confluence_backup_test.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/backups
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/IPP-308_move_backups_folder/backups merged eligible /branches/ipp-350_add_to_jira_conf_backups merged eligible /trunk/backups merged eligible /branches/czw_branch/20160809/backups 39651-39924 /branches/czw_branch/20170908/backups 40128-40486 /branches/ipp-259_genericise_backups/backups 40910-40966
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/backups/confluence_backup_test.py
r40967 r41067 34 34 , 'target_filename' : 'confluence.tar.gz' 35 35 , 'prefix_date' : 'True' 36 } 37 config['RSYNC'] = \ 38 { 'sources' : (f"{os.path.join(tmpdir, 'rsync_source_dir1')}," 39 f"{os.path.join(tmpdir, 'rsync_source_dir2')}") 40 , 'additional_args' : '-a --delete-after --exclude exclude_me_if_you_like' 41 , 'sub-dirs' : 'conf_subdir1, conf_subdir2' 36 42 } 37 43 config['MYSQLDUMP'] = \ … … 82 88 assert os.path.exists(confluence_attachment_2_filepath) 83 89 90 # Create a few folders to be rsync'd 91 rsync_source_dir1 = os.path.join(tmpdir, "rsync_source_dir1") 92 rsync_source_dir2 = os.path.join(tmpdir, "rsync_source_dir2") 93 file_in_rsync_dir1 = os.path.join(rsync_source_dir1, "some_file_to_rsync") 94 file_in_rsync_dir2 = os.path.join(rsync_source_dir2, "some_other_file_to_rsync") 95 exluded_file = os.path.join(rsync_source_dir1, "exclude_me_if_you_like") 96 os.makedirs(rsync_source_dir1) 97 os.makedirs(rsync_source_dir2) 98 Path(file_in_rsync_dir1).touch() 99 Path(file_in_rsync_dir2).touch() 100 Path(exluded_file).touch() 101 assert os.path.exists(file_in_rsync_dir1) 102 assert os.path.exists(file_in_rsync_dir2) 103 assert os.path.exists(exluded_file) 104 84 105 85 106 class TestArguments(object): … … 287 308 assert os.path.exists(expected_confluence_bak1_tar) 288 309 assert os.path.exists(expected_confluence_bak2_tar) 310 311 312 class TestRsyncOfFiles(object): 313 314 def test_confluence_rsync_with_subdirs(self, tmpdir): 315 """This should be similar to the regular Backup version""" 316 create_items_for_full_confluence_backup_test(tmpdir) 317 config = make_config(tmpdir) 318 319 cb = ConfluenceBackup(config_file=config) 320 321 # Expected resulting rsync directories 322 expected_confluence_host_rsync1 = os.path.join(tmpdir, "host_backup_path", "conf_subdir1", "rsync_source_dir1") 323 expected_confluence_bak1_rsync1 = os.path.join(tmpdir, "backup_1_path", "conf_subdir1", "rsync_source_dir1") 324 expected_confluence_bak2_rsync1 = os.path.join(tmpdir, "backup_2_path", "conf_subdir1", "rsync_source_dir1") 325 expected_confluence_host_rsync2 = os.path.join(tmpdir, "host_backup_path", "conf_subdir2", "rsync_source_dir2") 326 expected_confluence_bak1_rsync2 = os.path.join(tmpdir, "backup_1_path", "conf_subdir2", "rsync_source_dir2") 327 expected_confluence_bak2_rsync2 = os.path.join(tmpdir, "backup_2_path", "conf_subdir2", "rsync_source_dir2") 328 assert not os.path.exists(expected_confluence_host_rsync1) 329 assert not os.path.exists(expected_confluence_bak1_rsync1) 330 assert not os.path.exists(expected_confluence_bak2_rsync1) 331 assert not os.path.exists(expected_confluence_host_rsync2) 332 assert not os.path.exists(expected_confluence_bak1_rsync2) 333 assert not os.path.exists(expected_confluence_bak2_rsync2) 334 # Expected resulting rsync files 335 expected_file_host_dir1 = os.path.join( expected_confluence_host_rsync1, "some_file_to_rsync") 336 expected_file_bak1_dir1 = os.path.join( expected_confluence_bak1_rsync1, "some_file_to_rsync") 337 expected_file_bak2_dir1 = os.path.join( expected_confluence_bak2_rsync1, "some_file_to_rsync") 338 expected_file_host_dir2 = os.path.join( expected_confluence_host_rsync2, "some_other_file_to_rsync") 339 expected_file_bak1_dir2 = os.path.join( expected_confluence_bak1_rsync2, "some_other_file_to_rsync") 340 expected_file_bak2_dir2 = os.path.join( expected_confluence_bak2_rsync2, "some_other_file_to_rsync") 341 assert not os.path.exists(expected_file_host_dir1) 342 assert not os.path.exists(expected_file_bak1_dir1) 343 assert not os.path.exists(expected_file_bak2_dir1) 344 assert not os.path.exists(expected_file_host_dir2) 345 assert not os.path.exists(expected_file_bak1_dir2) 346 assert not os.path.exists(expected_file_bak2_dir2) 347 an_excluded_file = os.path.join(expected_confluence_host_rsync1, "exclude_me_if_you_like") 348 assert not os.path.exists(an_excluded_file) 349 350 rsync_result = cb._run_rsync() 351 assert rsync_result == 0 352 353 # All files Rsync'd 354 assert os.path.exists(expected_confluence_host_rsync1) 355 assert os.path.exists(expected_confluence_bak1_rsync1) 356 assert os.path.exists(expected_confluence_bak2_rsync1) 357 assert os.path.exists(expected_confluence_host_rsync2) 358 assert os.path.exists(expected_confluence_bak1_rsync2) 359 assert os.path.exists(expected_confluence_bak2_rsync2) 360 assert os.path.exists(expected_file_host_dir1) 361 assert os.path.exists(expected_file_bak1_dir1) 362 assert os.path.exists(expected_file_bak2_dir1) 363 assert os.path.exists(expected_file_host_dir2) 364 assert os.path.exists(expected_file_bak1_dir2) 365 assert os.path.exists(expected_file_bak2_dir2) 366 assert not os.path.exists(an_excluded_file)
Note:
See TracChangeset
for help on using the changeset viewer.
