diff --git a/test/t/001_ivfflat_wal.pl b/test/t/001_ivfflat_wal.pl index d56f131..84760ad 100644 --- a/test/t/001_ivfflat_wal.pl +++ b/test/t/001_ivfflat_wal.pl @@ -26,7 +26,8 @@ sub test_index_replay or die "Timed out while waiting for replica 1 to catch up"; my @r = (); - for (1 .. $dim) { + for (1 .. $dim) + { push(@r, rand()); } my $sql = join(",", @r); @@ -67,8 +68,7 @@ $node_primary->backup($backup_name); # Create streaming replica linking to primary $node_replica = get_new_node('replica'); -$node_replica->init_from_backup($node_primary, $backup_name, - has_streaming => 1); +$node_replica->init_from_backup($node_primary, $backup_name, has_streaming => 1); $node_replica->start; # Create ivfflat index on primary diff --git a/test/t/002_ivfflat_vacuum.pl b/test/t/002_ivfflat_vacuum.pl index 16ac0d6..37d01d0 100644 --- a/test/t/002_ivfflat_vacuum.pl +++ b/test/t/002_ivfflat_vacuum.pl @@ -7,7 +7,8 @@ use Test::More; my $dim = 3; my @r = (); -for (1 .. $dim) { +for (1 .. $dim) +{ my $v = int(rand(1000)) + 1; push(@r, "i % $v"); } diff --git a/test/t/003_ivfflat_recall.pl b/test/t/003_ivfflat_recall.pl index 173908a..2086d7e 100644 --- a/test/t/003_ivfflat_recall.pl +++ b/test/t/003_ivfflat_recall.pl @@ -57,7 +57,8 @@ $node->safe_psql("postgres", ); # Generate queries -for (1..20) { +for (1 .. 20) +{ my $r1 = rand(); my $r2 = rand(); my $r3 = rand(); @@ -67,7 +68,8 @@ for (1..20) { # Check each index type my @operators = ("<->", "<#>", "<=>"); -foreach (@operators) { +foreach (@operators) +{ my $operator = $_; # Get exact results @@ -93,7 +95,8 @@ foreach (@operators) { )); # Test approximate results - if ($operator ne "<#>") { + if ($operator ne "<#>") + { # TODO fix test test_recall(1, 0.73, $operator); test_recall(10, 0.95, $operator); @@ -113,7 +116,8 @@ foreach (@operators) { like($stderr, qr/using \d+ parallel workers/); # Test approximate results - if ($operator ne "<#>") { + if ($operator ne "<#>") + { # TODO fix test test_recall(1, 0.73, $operator); test_recall(10, 0.95, $operator); diff --git a/test/t/005_ivfflat_query_recall.pl b/test/t/005_ivfflat_query_recall.pl index 50bbb56..0739742 100644 --- a/test/t/005_ivfflat_query_recall.pl +++ b/test/t/005_ivfflat_query_recall.pl @@ -18,7 +18,8 @@ $node->safe_psql("postgres", # Check each index type my @operators = ("<->", "<#>", "<=>"); -foreach (@operators) { +foreach (@operators) +{ my $operator = $_; # Add index @@ -33,7 +34,8 @@ foreach (@operators) { $node->safe_psql("postgres", "CREATE INDEX ON tst USING ivfflat (v $opclass);"); # Test 100% recall - for (1..20) { + for (1 .. 20) + { my $i = int(rand() * 100000); my $query = $node->safe_psql("postgres", "SELECT v FROM tst WHERE i = $i;"); my $res = $node->safe_psql("postgres", qq( diff --git a/test/t/008_aggregates.pl b/test/t/008_aggregates.pl index c4425b4..0465890 100644 --- a/test/t/008_aggregates.pl +++ b/test/t/008_aggregates.pl @@ -30,7 +30,8 @@ sub test_aggregate # Test matches real for avg # Cannot test sum since sum(real) varies between calls - if ($agg eq 'avg') { + if ($agg eq 'avg') + { my $r1 = $node->safe_psql("postgres", "SELECT $agg(r1)::float4 FROM tst;"); my $r2 = $node->safe_psql("postgres", "SELECT $agg(r2)::float4 FROM tst;"); my $r3 = $node->safe_psql("postgres", "SELECT $agg(r3)::float4 FROM tst;"); diff --git a/test/t/010_hnsw_wal.pl b/test/t/010_hnsw_wal.pl index 1e1e3f0..d59a977 100644 --- a/test/t/010_hnsw_wal.pl +++ b/test/t/010_hnsw_wal.pl @@ -52,11 +52,13 @@ my $array_sql = join(",", ('random()') x $dim); # Initialize primary node $node_primary = get_new_node('primary'); $node_primary->init(allows_streaming => 1); -if ($dim > 32) { +if ($dim > 32) +{ # TODO use wal_keep_segments for Postgres < 13 $node_primary->append_conf('postgresql.conf', qq(wal_keep_size = 1GB)); } -if ($dim > 1500) { +if ($dim > 1500) +{ $node_primary->append_conf('postgresql.conf', qq(maintenance_work_mem = 128MB)); } $node_primary->start; @@ -67,8 +69,7 @@ $node_primary->backup($backup_name); # Create streaming replica linking to primary $node_replica = get_new_node('replica'); -$node_replica->init_from_backup($node_primary, $backup_name, - has_streaming => 1); +$node_replica->init_from_backup($node_primary, $backup_name, has_streaming => 1); $node_replica->start; # Create hnsw index on primary diff --git a/test/t/012_hnsw_build_recall.pl b/test/t/012_hnsw_build_recall.pl index d8fa2ab..a94601c 100644 --- a/test/t/012_hnsw_build_recall.pl +++ b/test/t/012_hnsw_build_recall.pl @@ -55,7 +55,8 @@ $node->safe_psql("postgres", ); # Generate queries -for (1..20) { +for (1 .. 20) +{ my $r1 = rand(); my $r2 = rand(); my $r3 = rand(); @@ -65,12 +66,14 @@ for (1..20) { # Check each index type my @operators = ("<->", "<#>", "<=>"); -foreach (@operators) { +foreach (@operators) +{ my $operator = $_; # Get exact results @expected = (); - foreach (@queries) { + foreach (@queries) + { my $res = $node->safe_psql("postgres", "SELECT i FROM tst ORDER BY v $operator '$_' LIMIT $limit;"); push(@expected, $res); } diff --git a/test/t/013_hnsw_insert_recall.pl b/test/t/013_hnsw_insert_recall.pl index 57648df..c77e2f7 100644 --- a/test/t/013_hnsw_insert_recall.pl +++ b/test/t/013_hnsw_insert_recall.pl @@ -52,7 +52,8 @@ $node->safe_psql("postgres", "CREATE EXTENSION vector;"); $node->safe_psql("postgres", "CREATE TABLE tst (i serial, v vector(3));"); # Generate queries -for (1..20) { +for (1 .. 20) +{ my $r1 = rand(); my $r2 = rand(); my $r3 = rand(); @@ -62,7 +63,8 @@ for (1..20) { # Check each index type my @operators = ("<->", "<#>", "<=>"); -foreach (@operators) { +foreach (@operators) +{ my $operator = $_; # Add index @@ -90,7 +92,8 @@ foreach (@operators) { # Get exact results @expected = (); - foreach (@queries) { + foreach (@queries) + { my $res = $node->safe_psql("postgres", qq( SET enable_indexscan = off; SELECT i FROM tst ORDER BY v $operator '$_' LIMIT $limit; diff --git a/test/t/015_hnsw_duplicates.pl b/test/t/015_hnsw_duplicates.pl index b0224cf..7e11dee 100644 --- a/test/t/015_hnsw_duplicates.pl +++ b/test/t/015_hnsw_duplicates.pl @@ -15,7 +15,8 @@ $node->safe_psql("postgres", "CREATE TABLE tst (v vector(3));"); sub insert_vectors { - for my $i (1 .. 20) { + for my $i (1 .. 20) + { $node->safe_psql("postgres", "INSERT INTO tst VALUES ('[1,1,1]');"); } }