- Timestamp:
- Nov 5, 2019, 9:17:31 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ipp-350_add_to_jira_conf_backups/jira_backup_test.py
r40967 r41059 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' 35 40 } 36 41 config['MYSQLDUMP'] = \ … … 81 86 assert os.path.exists(jira_attachment_2_filepath) 82 87 88 # Create a few folders to be rsync'd 89 rsync_source_dir1 = os.path.join(tmpdir, "rsync_source_dir1") 90 rsync_source_dir2 = os.path.join(tmpdir, "rsync_source_dir2") 91 file_in_rsync_dir1 = os.path.join(rsync_source_dir1, "some_file_to_rsync") 92 file_in_rsync_dir2 = os.path.join(rsync_source_dir2, "some_other_file_to_rsync") 93 os.makedirs(rsync_source_dir1) 94 os.makedirs(rsync_source_dir2) 95 Path(file_in_rsync_dir1).touch() 96 Path(file_in_rsync_dir2).touch() 97 assert os.path.exists(file_in_rsync_dir1) 98 assert os.path.exists(file_in_rsync_dir2) 99 83 100 84 101 class TestArguments(object): … … 288 305 assert os.path.exists(expected_jira_bak1_tar) 289 306 assert os.path.exists(expected_jira_bak2_tar) 307 308 309 class TestRsyncOfFiles(object): 310 311 def test_jira_rsync(self, tmpdir): 312 """This should be similar to the regular Backup version""" 313 create_items_for_full_jira_backup_test(tmpdir) 314 config = make_config(tmpdir) 315 316 jb = JiraBackup(config_file=config) 317 318 # Expected resulting rsync directories 319 expected_jira_host_rsync1 = os.path.join(tmpdir, "host_backup_path", "rsync_source_dir1") 320 expected_jira_bak1_rsync1 = os.path.join(tmpdir, "backup_1_path", "rsync_source_dir1") 321 expected_jira_bak2_rsync1 = os.path.join(tmpdir, "backup_2_path", "rsync_source_dir1") 322 expected_jira_host_rsync2 = os.path.join(tmpdir, "host_backup_path", "rsync_source_dir2") 323 expected_jira_bak1_rsync2 = os.path.join(tmpdir, "backup_1_path", "rsync_source_dir2") 324 expected_jira_bak2_rsync2 = os.path.join(tmpdir, "backup_2_path", "rsync_source_dir2") 325 assert not os.path.exists(expected_jira_host_rsync1) 326 assert not os.path.exists(expected_jira_bak1_rsync1) 327 assert not os.path.exists(expected_jira_bak2_rsync1) 328 assert not os.path.exists(expected_jira_host_rsync2) 329 assert not os.path.exists(expected_jira_bak1_rsync2) 330 assert not os.path.exists(expected_jira_bak2_rsync2) 331 # Expected resulting rsync files 332 expected_file_host_dir1 = os.path.join( expected_jira_host_rsync1, "some_file_to_rsync") 333 expected_file_bak1_dir1 = os.path.join( expected_jira_bak1_rsync1, "some_file_to_rsync") 334 expected_file_bak2_dir1 = os.path.join( expected_jira_bak2_rsync1, "some_file_to_rsync") 335 expected_file_host_dir2 = os.path.join( expected_jira_host_rsync2, "some_other_file_to_rsync") 336 expected_file_bak1_dir2 = os.path.join( expected_jira_bak1_rsync2, "some_other_file_to_rsync") 337 expected_file_bak2_dir2 = os.path.join( expected_jira_bak2_rsync2, "some_other_file_to_rsync") 338 assert not os.path.exists(expected_file_host_dir1) 339 assert not os.path.exists(expected_file_bak1_dir1) 340 assert not os.path.exists(expected_file_bak2_dir1) 341 assert not os.path.exists(expected_file_host_dir2) 342 assert not os.path.exists(expected_file_bak1_dir2) 343 assert not os.path.exists(expected_file_bak2_dir2) 344 345 rsync_result = jb._run_rsync() 346 assert rsync_result == 0 347 348 # All files Rsync'd 349 assert os.path.exists(expected_jira_host_rsync1) 350 assert os.path.exists(expected_jira_bak1_rsync1) 351 assert os.path.exists(expected_jira_bak2_rsync1) 352 assert os.path.exists(expected_jira_host_rsync2) 353 assert os.path.exists(expected_jira_bak1_rsync2) 354 assert os.path.exists(expected_jira_bak2_rsync2) 355 assert os.path.exists(expected_file_host_dir1) 356 assert os.path.exists(expected_file_bak1_dir1) 357 assert os.path.exists(expected_file_bak2_dir1) 358 assert os.path.exists(expected_file_host_dir2) 359 assert os.path.exists(expected_file_bak1_dir2) 360 assert os.path.exists(expected_file_bak2_dir2)
Note:
See TracChangeset
for help on using the changeset viewer.
