Changeset 41067 for trunk/backups/jira_backup_test.py
- Timestamp:
- Nov 5, 2019, 3:18:35 PM (7 years ago)
- Location:
- trunk/backups
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
jira_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/jira_backup_test.py
r40967 r41067 33 33 , 'target_filename' : 'jira.tar.gz' 34 34 , 'prefix_date' : 'True' 35 } 36 config['RSYNC'] = \ 37 { 'sources' : (f"{os.path.join(tmpdir, 'rsync_source_dir1')}," 38 f"{os.path.join(tmpdir, 'rsync_source_dir2')}") 39 , 'additional_args' : '-a --delete-after' 40 , 'sub-dirs' : 'jira_subdir1, jira_subdir2' 35 41 } 36 42 config['MYSQLDUMP'] = \ … … 81 87 assert os.path.exists(jira_attachment_2_filepath) 82 88 89 # Create a few folders to be rsync'd 90 rsync_source_dir1 = os.path.join(tmpdir, "rsync_source_dir1") 91 rsync_source_dir2 = os.path.join(tmpdir, "rsync_source_dir2") 92 file_in_rsync_dir1 = os.path.join(rsync_source_dir1, "some_file_to_rsync") 93 file_in_rsync_dir2 = os.path.join(rsync_source_dir2, "some_other_file_to_rsync") 94 os.makedirs(rsync_source_dir1) 95 os.makedirs(rsync_source_dir2) 96 Path(file_in_rsync_dir1).touch() 97 Path(file_in_rsync_dir2).touch() 98 assert os.path.exists(file_in_rsync_dir1) 99 assert os.path.exists(file_in_rsync_dir2) 100 83 101 84 102 class TestArguments(object): … … 288 306 assert os.path.exists(expected_jira_bak1_tar) 289 307 assert os.path.exists(expected_jira_bak2_tar) 308 309 310 class TestRsyncOfFiles(object): 311 312 def test_jira_rsync_with_subdirs(self, tmpdir): 313 """This should be similar to the regular Backup version""" 314 create_items_for_full_jira_backup_test(tmpdir) 315 config = make_config(tmpdir) 316 317 jb = JiraBackup(config_file=config) 318 319 # Expected resulting rsync directories 320 expected_jira_host_rsync1 = os.path.join(tmpdir, "host_backup_path", "jira_subdir1", "rsync_source_dir1") 321 expected_jira_bak1_rsync1 = os.path.join(tmpdir, "backup_1_path", "jira_subdir1", "rsync_source_dir1") 322 expected_jira_bak2_rsync1 = os.path.join(tmpdir, "backup_2_path", "jira_subdir1", "rsync_source_dir1") 323 expected_jira_host_rsync2 = os.path.join(tmpdir, "host_backup_path", "jira_subdir2", "rsync_source_dir2") 324 expected_jira_bak1_rsync2 = os.path.join(tmpdir, "backup_1_path", "jira_subdir2", "rsync_source_dir2") 325 expected_jira_bak2_rsync2 = os.path.join(tmpdir, "backup_2_path", "jira_subdir2", "rsync_source_dir2") 326 assert not os.path.exists(expected_jira_host_rsync1) 327 assert not os.path.exists(expected_jira_bak1_rsync1) 328 assert not os.path.exists(expected_jira_bak2_rsync1) 329 assert not os.path.exists(expected_jira_host_rsync2) 330 assert not os.path.exists(expected_jira_bak1_rsync2) 331 assert not os.path.exists(expected_jira_bak2_rsync2) 332 # Expected resulting rsync files 333 expected_file_host_dir1 = os.path.join( expected_jira_host_rsync1, "some_file_to_rsync") 334 expected_file_bak1_dir1 = os.path.join( expected_jira_bak1_rsync1, "some_file_to_rsync") 335 expected_file_bak2_dir1 = os.path.join( expected_jira_bak2_rsync1, "some_file_to_rsync") 336 expected_file_host_dir2 = os.path.join( expected_jira_host_rsync2, "some_other_file_to_rsync") 337 expected_file_bak1_dir2 = os.path.join( expected_jira_bak1_rsync2, "some_other_file_to_rsync") 338 expected_file_bak2_dir2 = os.path.join( expected_jira_bak2_rsync2, "some_other_file_to_rsync") 339 assert not os.path.exists(expected_file_host_dir1) 340 assert not os.path.exists(expected_file_bak1_dir1) 341 assert not os.path.exists(expected_file_bak2_dir1) 342 assert not os.path.exists(expected_file_host_dir2) 343 assert not os.path.exists(expected_file_bak1_dir2) 344 assert not os.path.exists(expected_file_bak2_dir2) 345 346 rsync_result = jb._run_rsync() 347 assert rsync_result == 0 348 349 # All files Rsync'd 350 assert os.path.exists(expected_jira_host_rsync1) 351 assert os.path.exists(expected_jira_bak1_rsync1) 352 assert os.path.exists(expected_jira_bak2_rsync1) 353 assert os.path.exists(expected_jira_host_rsync2) 354 assert os.path.exists(expected_jira_bak1_rsync2) 355 assert os.path.exists(expected_jira_bak2_rsync2) 356 assert os.path.exists(expected_file_host_dir1) 357 assert os.path.exists(expected_file_bak1_dir1) 358 assert os.path.exists(expected_file_bak2_dir1) 359 assert os.path.exists(expected_file_host_dir2) 360 assert os.path.exists(expected_file_bak1_dir2) 361 assert os.path.exists(expected_file_bak2_dir2)
Note:
See TracChangeset
for help on using the changeset viewer.
