- 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/confluence_backup_test.py
r40967 r41059 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' 36 41 } 37 42 config['MYSQLDUMP'] = \ … … 82 87 assert os.path.exists(confluence_attachment_2_filepath) 83 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 84 101 85 102 class TestArguments(object): … … 287 304 assert os.path.exists(expected_confluence_bak1_tar) 288 305 assert os.path.exists(expected_confluence_bak2_tar) 306 307 308 class TestRsyncOfFiles(object): 309 310 def test_confluence_rsync(self, tmpdir): 311 """This should be similar to the regular Backup version""" 312 create_items_for_full_confluence_backup_test(tmpdir) 313 config = make_config(tmpdir) 314 315 cb = ConfluenceBackup(config_file=config) 316 317 # Expected resulting rsync directories 318 expected_confluence_host_rsync1 = os.path.join(tmpdir, "host_backup_path", "rsync_source_dir1") 319 expected_confluence_bak1_rsync1 = os.path.join(tmpdir, "backup_1_path", "rsync_source_dir1") 320 expected_confluence_bak2_rsync1 = os.path.join(tmpdir, "backup_2_path", "rsync_source_dir1") 321 expected_confluence_host_rsync2 = os.path.join(tmpdir, "host_backup_path", "rsync_source_dir2") 322 expected_confluence_bak1_rsync2 = os.path.join(tmpdir, "backup_1_path", "rsync_source_dir2") 323 expected_confluence_bak2_rsync2 = os.path.join(tmpdir, "backup_2_path", "rsync_source_dir2") 324 assert not os.path.exists(expected_confluence_host_rsync1) 325 assert not os.path.exists(expected_confluence_bak1_rsync1) 326 assert not os.path.exists(expected_confluence_bak2_rsync1) 327 assert not os.path.exists(expected_confluence_host_rsync2) 328 assert not os.path.exists(expected_confluence_bak1_rsync2) 329 assert not os.path.exists(expected_confluence_bak2_rsync2) 330 # Expected resulting rsync files 331 expected_file_host_dir1 = os.path.join( expected_confluence_host_rsync1, "some_file_to_rsync") 332 expected_file_bak1_dir1 = os.path.join( expected_confluence_bak1_rsync1, "some_file_to_rsync") 333 expected_file_bak2_dir1 = os.path.join( expected_confluence_bak2_rsync1, "some_file_to_rsync") 334 expected_file_host_dir2 = os.path.join( expected_confluence_host_rsync2, "some_other_file_to_rsync") 335 expected_file_bak1_dir2 = os.path.join( expected_confluence_bak1_rsync2, "some_other_file_to_rsync") 336 expected_file_bak2_dir2 = os.path.join( expected_confluence_bak2_rsync2, "some_other_file_to_rsync") 337 assert not os.path.exists(expected_file_host_dir1) 338 assert not os.path.exists(expected_file_bak1_dir1) 339 assert not os.path.exists(expected_file_bak2_dir1) 340 assert not os.path.exists(expected_file_host_dir2) 341 assert not os.path.exists(expected_file_bak1_dir2) 342 assert not os.path.exists(expected_file_bak2_dir2) 343 344 rsync_result = cb._run_rsync() 345 assert rsync_result == 0 346 347 # All files Rsync'd 348 assert os.path.exists(expected_confluence_host_rsync1) 349 assert os.path.exists(expected_confluence_bak1_rsync1) 350 assert os.path.exists(expected_confluence_bak2_rsync1) 351 assert os.path.exists(expected_confluence_host_rsync2) 352 assert os.path.exists(expected_confluence_bak1_rsync2) 353 assert os.path.exists(expected_confluence_bak2_rsync2) 354 assert os.path.exists(expected_file_host_dir1) 355 assert os.path.exists(expected_file_bak1_dir1) 356 assert os.path.exists(expected_file_bak2_dir1) 357 assert os.path.exists(expected_file_host_dir2) 358 assert os.path.exists(expected_file_bak1_dir2) 359 assert os.path.exists(expected_file_bak2_dir2)
Note:
See TracChangeset
for help on using the changeset viewer.
