Reorder connection markers in loadbalance tests
authorDaniel Gustafsson <[email protected]>
Fri, 21 Apr 2023 10:29:38 +0000 (12:29 +0200)
committerDaniel Gustafsson <[email protected]>
Fri, 21 Apr 2023 10:29:38 +0000 (12:29 +0200)
Commit 7f5b198 introduced TAP tests that use string literals to mark
the presence of a query in server logs.  Reorder the markers to make
sure they are used in alphabetical order for easier debugging.

Author: Gurjeet Singh <[email protected]>
Reviewed-by: Jelte Fennema <[email protected]>
Discussion: https://postgr.es/m/CABwTF4WcYAENqyUQS2crAYfDuJ497v82ty2-MirjaC+zz9e8nQ@mail.gmail.com

src/interfaces/libpq/t/003_load_balance_host_list.pl
src/interfaces/libpq/t/004_load_balance_dns.pl

index 6963ef38499aa57a501ee864a49af8f87ff2e5d8..7f1bb0c5bc38d8f72966ddcea834cc5aafcf4aec 100644 (file)
@@ -36,8 +36,8 @@ $node1->connect_fails(
 # load_balance_hosts=disable should always choose the first one.
 $node1->connect_ok("host=$hostlist port=$portlist load_balance_hosts=disable",
        "load_balance_hosts=disable connects to the first node",
-       sql => "SELECT 'connect2'",
-       log_like => [qr/statement: SELECT 'connect2'/]);
+       sql => "SELECT 'connect1'",
+       log_like => [qr/statement: SELECT 'connect1'/]);
 
 # Statistically the following loop with load_balance_hosts=random will almost
 # certainly connect at least once to each of the nodes. The chance of that not
@@ -45,12 +45,12 @@ $node1->connect_ok("host=$hostlist port=$portlist load_balance_hosts=disable",
 foreach my $i (1 .. 50) {
        $node1->connect_ok("host=$hostlist port=$portlist load_balance_hosts=random",
                "repeated connections with random load balancing",
-               sql => "SELECT 'connect1'");
+               sql => "SELECT 'connect2'");
 }
 
-my $node1_occurences = () = $node1->log_content() =~ /statement: SELECT 'connect1'/g;
-my $node2_occurences = () = $node2->log_content() =~ /statement: SELECT 'connect1'/g;
-my $node3_occurences = () = $node3->log_content() =~ /statement: SELECT 'connect1'/g;
+my $node1_occurences = () = $node1->log_content() =~ /statement: SELECT 'connect2'/g;
+my $node2_occurences = () = $node2->log_content() =~ /statement: SELECT 'connect2'/g;
+my $node3_occurences = () = $node3->log_content() =~ /statement: SELECT 'connect2'/g;
 
 my $total_occurences = $node1_occurences + $node2_occurences + $node3_occurences;
 
index d9b382dba978a390db1fbe40928412315cc65dfa..c66ee2461ade5950d1e2d316d9ed3b23d9757935 100644 (file)
@@ -78,8 +78,8 @@ $node3->start();
 # load_balance_hosts=disable should always choose the first one.
 $node1->connect_ok("host=pg-loadbalancetest port=$port load_balance_hosts=disable",
        "load_balance_hosts=disable connects to the first node",
-       sql => "SELECT 'connect2'",
-       log_like => [qr/statement: SELECT 'connect2'/]);
+       sql => "SELECT 'connect1'",
+       log_like => [qr/statement: SELECT 'connect1'/]);
 
 
 # Statistically the following loop with load_balance_hosts=random will almost
@@ -88,12 +88,12 @@ $node1->connect_ok("host=pg-loadbalancetest port=$port load_balance_hosts=disabl
 foreach my $i (1 .. 50) {
        $node1->connect_ok("host=pg-loadbalancetest port=$port load_balance_hosts=random",
                "repeated connections with random load balancing",
-               sql => "SELECT 'connect1'");
+               sql => "SELECT 'connect2'");
 }
 
-my $node1_occurences = () = $node1->log_content() =~ /statement: SELECT 'connect1'/g;
-my $node2_occurences = () = $node2->log_content() =~ /statement: SELECT 'connect1'/g;
-my $node3_occurences = () = $node3->log_content() =~ /statement: SELECT 'connect1'/g;
+my $node1_occurences = () = $node1->log_content() =~ /statement: SELECT 'connect2'/g;
+my $node2_occurences = () = $node2->log_content() =~ /statement: SELECT 'connect2'/g;
+my $node3_occurences = () = $node3->log_content() =~ /statement: SELECT 'connect2'/g;
 
 my $total_occurences = $node1_occurences + $node2_occurences + $node3_occurences;