fix tests so that testing works

parent 70aa2372
-- load pgtap - change next line to point to correct path for your system!
\i /home/pgdba/work/share/postgresql/contrib/pgtap.sql
create extension pgtap;
......@@ -2,7 +2,7 @@ BEGIN;
-- load pgtap - change next line to point to correct path for your system!
\i t/00-load.sql.inc
SELECT plan(11);
SELECT plan(10);
SELECT has_schema( '_v', 'There should be schema _v for versioning to work.' );
SELECT has_table( '_v', 'patches', 'There should be _v.patches table for versioning to work.' );
......@@ -14,10 +14,10 @@ BEGIN;
SELECT has_column( '_v', 'patches', 'conflicts', '_v.patches should have conflicts column.' );
SELECT has_function( '_v', 'register_patch', ARRAY[ 'text', 'text[]', 'text[]' ], 'register_patch(text, text[], text[]) should exist to be able to register patches' );
SELECT has_function( '_v', 'register_patch', ARRAY[ 'text' ], 'register_patch(text) should exist to be able to register patches (in simpler way)' );
SELECT has_function( '_v', 'unregister_patch', ARRAY[ 'text' ], 'unregister_patch(text) should exist to be able to unregister patches that are no longer needed' );
SELECT is( ( SELECT count(*) FROM _v.patches ), 0::bigint, 'When running tests _v.patches table should be empty to prevent bad interactions between patches and tests.' );
SELECT * FROM finish();
ROLLBACK;
......@@ -12,8 +12,8 @@ BEGIN;
);
SELECT results_eq(
'SELECT patch_name, applied_tsz, applied_by, requires, conflicts FROM _v.patches',
$$SELECT 'first_patch'::text as patch_name, now() as applied_tsz, current_user::TEXT as applied_by, '{}'::TEXT[] as requires, '{}'::TEXT[] as conflicts$$,
'SELECT patch_name COLLATE "C", applied_tsz, applied_by COLLATE "C", requires, conflicts FROM _v.patches',
$$SELECT 'first_patch'::text COLLATE "C" as patch_name, now() as applied_tsz, current_user::TEXT COLLATE "C" as applied_by, '{}'::TEXT[] as requires, '{}'::TEXT[] as conflicts$$,
'Sanity check if patch is correctly saved.'
);
......@@ -67,5 +67,7 @@ BEGIN;
'De-Installation of patch.'
);
SELECT * FROM finish();
ROLLBACK;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment