From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | David Steele <david(at)pgmasters(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> |
Cc: | Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> |
Subject: | Re: PATCH: Unlogged tables re-initialization tests |
Date: | 2018-03-09 22:23:48 |
Message-ID: | 591b7222-2548-8c9a-8340-dadef9791f20@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
This seems like a useful test.
On 3/5/18 12:35, David Steele wrote:
> +mkdir($tablespaceDir)
> + or die "unable to mkdir \"$tablespaceDir\"";
Use BAIL_OUT instead of die in tests.
> + $ts1UnloggedPath = $node->safe_psql('postgres',
> + q{select pg_relation_filepath('ts1_unlogged')});
strange indentation
> +# Write forks to test that they are removed during recovery
> +$node->command_ok(['touch', "$pgdata/${baseUnloggedPath}_vm"],
> + 'touch vm fork in base');
> +$node->command_ok(['touch', "$pgdata/${baseUnloggedPath}_fsm"],
> + 'touch fsm fork in base');
These are not tests, just some prep work. So they should not use
command_ok.
It would probably also be better to avoid the Unix-specific touch
command and instead use Perl code to open and write to the files.
> +# Check unlogged table in base
> +ok(-f "$pgdata/${baseUnloggedPath}_init", 'init fork in base');
> +ok(-f "$pgdata/$baseUnloggedPath", 'main fork in base');
> +ok(!-f "$pgdata/${baseUnloggedPath}_vm", 'vm fork not in base');
> +ok(!-f "$pgdata/${baseUnloggedPath}_fsm", 'fsm fork not in base');
These test names could be a bit more verbose and distinct, for example,
'main fork was recreated after restart'.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2018-03-09 22:37:49 | Bogus use of canonicalize_qual |
Previous Message | Daniel Verite | 2018-03-09 22:18:22 | Re: csv format for psql |