Fix test case instability introduced in 085b6b667.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 11 Mar 2020 22:23:57 +0000 (18:23 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 11 Mar 2020 22:24:14 +0000 (18:24 -0400)
I forgot that the WAL directory might hold other files besides WAL
segments, notably including new segments still being filled.
That means a blind test for the first file's size being 16MB can
fail.  Restrict based on file name length to make it more robust.

Per buildfarm.

src/test/regress/expected/misc_functions.out
src/test/regress/sql/misc_functions.sql

index a1ee4dbb3b536c0831e2f409472bf5f3aadd21a8..b65f0849098f320190e084f57fcc88ab8f63bdda 100644 (file)
@@ -167,7 +167,8 @@ select count(*) > 0 as ok from (select * from pg_ls_waldir() limit 1) ss;
  t
 (1 row)
 
-select (pg_ls_waldir()).size = :segsize as ok limit 1;
+select (w).size = :segsize as ok
+from (select pg_ls_waldir() w) ss where length((w).name) = 24 limit 1;
  ok 
 ----
  t
index 795587e70f68662823faecf12160f3f4fca84db1..b65cd961fcc411c2ade8381899bc84aa8a3676d4 100644 (file)
@@ -46,4 +46,5 @@ select count(*) > 0 as ok from (select pg_ls_waldir()) ss;
 -- Test not-run-to-completion cases.
 select * from pg_ls_waldir() limit 0;
 select count(*) > 0 as ok from (select * from pg_ls_waldir() limit 1) ss;
-select (pg_ls_waldir()).size = :segsize as ok limit 1;
+select (w).size = :segsize as ok
+from (select pg_ls_waldir() w) ss where length((w).name) = 24 limit 1;