@@ -2746,3 +2746,56 @@ def test_note_sanity(self):
2746
2746
2747
2747
# Clean after yourself
2748
2748
self .del_test_dir (module_name , fname )
2749
+
2750
+ # @unittest.skip("skip")
2751
+ def test_parent_backup_made_by_newer_version (self ):
2752
+ """incremental backup with parent made by newer version"""
2753
+ fname = self .id ().split ('.' )[3 ]
2754
+ node = self .make_simple_node (
2755
+ base_dir = os .path .join (module_name , fname , 'node' ),
2756
+ initdb_params = ['--data-checksums' ])
2757
+
2758
+ backup_dir = os .path .join (self .tmp_path , module_name , fname , 'backup' )
2759
+ self .init_pb (backup_dir )
2760
+ self .add_instance (backup_dir , 'node' , node )
2761
+ self .set_archiving (backup_dir , 'node' , node )
2762
+ node .slow_start ()
2763
+
2764
+ backup_id = self .backup_node (backup_dir , 'node' , node )
2765
+
2766
+ control_file = os .path .join (
2767
+ backup_dir , "backups" , "node" , backup_id ,
2768
+ "backup.control" )
2769
+
2770
+ version = self .probackup_version
2771
+ fake_new_version = str (int (version .split ('.' )[0 ]) + 1 ) + '.0.0'
2772
+
2773
+ with open (control_file , 'r' ) as f :
2774
+ data = f .read ();
2775
+
2776
+ data = data .replace (version , fake_new_version )
2777
+
2778
+ with open (control_file , 'w' ) as f :
2779
+ f .write (data );
2780
+
2781
+ try :
2782
+ self .backup_node (backup_dir , 'node' , node , backup_type = "page" )
2783
+ # we should die here because exception is what we expect to happen
2784
+ self .assertEqual (
2785
+ 1 , 0 ,
2786
+ "Expecting Error because incremental backup should not be possible "
2787
+ "if parent made by newer version.\n Output: {0} \n CMD: {1}" .format (
2788
+ repr (self .output ), self .cmd ))
2789
+ except ProbackupException as e :
2790
+ self .assertIn (
2791
+ "pg_probackup do not guarantee to be forward compatible. "
2792
+ "Please upgrade pg_probackup binary." ,
2793
+ e .message ,
2794
+ "\n Unexpected Error Message: {0}\n CMD: {1}" .format (
2795
+ repr (e .message ), self .cmd ))
2796
+
2797
+ self .assertEqual (
2798
+ self .show_pb (backup_dir , 'node' )[1 ]['status' ], "ERROR" )
2799
+
2800
+ # Clean after yourself
2801
+ self .del_test_dir (module_name , fname )
0 commit comments