This simplifies working with tests a lot since now we will also always
get the errors from failed queries directly in the test output instead
of it being truncated when the TAP tests aborts due to the query
failing.
There is still a good case for why we should instead write idiomatic TAP
tests but this at least does a lot to improve the expereince of people
who have to work with these tests without changing the way the tests
work. Plus that the code is cleaner now so it should be easier to move
away from this way of testing in the future.
pull/220/head
Andreas Karlsson5 months agocommitted byAndreas Karlsson
my($cmdret,$stdout,$stderr)=$node->psql('postgres','CREATE EXTENSION IF NOT EXISTS pg_tde;',extra_params=>['-a']);
ok($cmdret==0,"CREATE PGTDE EXTENSION");
PGTDE::append_to_file($stdout);
PGTDE::psql($node,'postgres','CREATE EXTENSION IF NOT EXISTS pg_tde;');
$rt_value=$node->psql('postgres',"SELECT pg_tde_add_database_key_provider_file('file-provider', json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8888/hello' ));",extra_params=>['-a']);
PGTDE::psql($node,'postgres',"SELECT pg_tde_add_database_key_provider_file('file-provider', json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8888/hello' ));");
my($cmdret,$stdout,$stderr)=$node->psql('postgres','CREATE EXTENSION IF NOT EXISTS pg_tde;',extra_params=>['-a']);
ok($cmdret==0,"CREATE PGTDE EXTENSION");
PGTDE::append_to_file($stdout);
PGTDE::psql($node,'postgres','CREATE EXTENSION IF NOT EXISTS pg_tde;');
$rt_value=$node->psql('postgres',"SELECT pg_tde_add_database_key_provider_file('file-provider', json_object( 'type' VALUE 'file', 'path' VALUE '/tmp/datafile-location' ));",extra_params=>['-a']);
PGTDE::psql($node,'postgres',"SELECT pg_tde_add_database_key_provider_file('file-provider', json_object( 'type' VALUE 'file', 'path' VALUE '/tmp/datafile-location' ));");
my($cmdret,$stdout,$stderr)=$node->psql('postgres','CREATE EXTENSION IF NOT EXISTS pg_tde;',extra_params=>['-a']);
ok($cmdret==0,"CREATE PGTDE EXTENSION");
PGTDE::append_to_file($stdout);
PGTDE::psql($node,'postgres','CREATE EXTENSION IF NOT EXISTS pg_tde;');
$rt_value=$node->psql('postgres',"SELECT pg_tde_add_database_key_provider_vault_v2('vault-provider', json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8889/token' ), json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8889/url' ), to_json('secret'::text), NULL);",extra_params=>['-a']);
PGTDE::psql($node,'postgres',"SELECT pg_tde_add_database_key_provider_vault_v2('vault-provider', json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8889/token' ), json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8889/url' ), to_json('secret'::text), NULL);");
(undef,$stdout,$stderr)=$node->psql('postgres','SELECT * FROM test_enc ORDER BY id;',extra_params=>['-a']);
PGTDE::append_to_file($stdout);
PGTDE::append_to_file($stderr);
(undef,$stdout,$stderr)=$node->psql('postgres','CREATE TABLE test_enc2 (id serial, k integer, PRIMARY KEY (id)) USING tde_heap;',extra_params=>['-a']);
SELECT pg_tde_add_database_key_provider_vault_v2('vault-provider', json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8889/token' ), json_object( 'type' VALUE 'remote', 'url' VALUE 'http://localhost:8889/url' ), to_json('secret'::text), NULL);