11# Test generic xlog record work for rum index replication.
22use strict;
33use warnings;
4- use PostgreSQL::Test::Cluster;
5- use PostgreSQL::Test::Utils;
64use Test::More tests => 31;
75
6+ my $pg_15_modules ;
7+
8+ BEGIN
9+ {
10+ $pg_15_modules = eval
11+ {
12+ require PostgreSQL::Test::Cluster;
13+ require PostgreSQL::Test::Utils;
14+ return 1;
15+ };
16+
17+ unless (defined $pg_15_modules )
18+ {
19+ $pg_15_modules = 0;
20+
21+ require PostgresNode;
22+ require TestLib;
23+ }
24+ }
25+
26+ note(' PostgreSQL 15 modules are used: ' . ($pg_15_modules ? ' yes' : ' no' ));
27+
28+
829my $node_master ;
930my $node_standby ;
1031
@@ -50,7 +71,23 @@ sub test_index_replay
5071}
5172
5273# Initialize master node
53- $node_master = PostgreSQL::Test::Cluster-> new(' master' );
74+
75+ # Create node.
76+ # Older versions of PostgreSQL modules use get_new_node function.
77+ # Newer use standard perl object constructor syntax.
78+ # Also applies for node_standby (below).
79+ eval
80+ {
81+ if ($pg_15_modules )
82+ {
83+ $node_master = PostgreSQL::Test::Cluster-> new(" master" );
84+ }
85+ else
86+ {
87+ $node_master = PostgresNode::get_new_node(" master" );
88+ }
89+ };
90+
5491$node_master -> init(allows_streaming => 1);
5592$node_master -> start;
5693my $backup_name = ' my_backup' ;
@@ -59,7 +96,18 @@ sub test_index_replay
5996$node_master -> backup($backup_name );
6097
6198# Create streaming standby linking to master
62- $node_standby = PostgreSQL::Test::Cluster-> new(' standby' );
99+ eval
100+ {
101+ if ($pg_15_modules )
102+ {
103+ $node_standby = PostgreSQL::Test::Cluster-> new(" standby" );
104+ }
105+ else
106+ {
107+ $node_standby = PostgresNode::get_new_node(" standby" );
108+ }
109+ };
110+
63111$node_standby -> init_from_backup($node_master , $backup_name ,
64112 has_streaming => 1);
65113$node_standby -> start;
0 commit comments