\set ECHO none # Subtest: _trunklet_test.test__name_sanity() ok 1 - threw 22023: field_name must not be NULL ok 2 - threw 22023: field_name must not be blank ok 3 - threw 22023: field_name must not begin with whitespace ok 4 - threw 22023: field_name must not begin with whitespace ok 5 - threw 22023: field_name must not end with whitespace ok 6 - threw 22023: field_name must not begin with whitespace ok 7 - threw 22023: field_name must not begin with whitespace ok 8 - threw 22023: field_name must not end with whitespace ok 9 - threw 22023: field_name must not begin with whitespace ok 10 - threw 22023: field_name must not begin with whitespace ok 11 - threw 22023: field_name must not end with whitespace 1..11 ok 1 - _trunklet_test.test__name_sanity # Subtest: _trunklet_test.test__table_language() ok 1 - Column _trunklet.language.language_name should be type character varying(100) ok 2 - Verify CHECK constraint on _trunklet.language.language_name 1..2 ok 2 - _trunklet_test.test__table_language # Subtest: _trunklet_test.test__table_template() ok 1 - c_language_id IS NOT NULL ok 2 - (template_name, template_version) should be unique ok 3 - Role public should be granted no privileges on table _trunklet.template ok 4 - Role trunklet__dependency should be granted REFERENCES on table _trunklet.template ok 5 - Verify CHECK constraint on _trunklet.template.template_name 1..5 ok 3 - _trunklet_test.test__table_template # Subtest: _trunklet_test.test_execute_into() ok 1 - Create test view ok 2 - Create predefined templates ok 3 - Create test role ok 4 - Grant test role USAGE on test schema ok 5 - Change to test role ok 6 - Verify role change ok 7 - trunklet.execute_into__language( ..., 'SELECT array[%L]', '{a}' ) ok 8 - trunklet.execute_into__language( ..., 'SELECT array[replace(%L, %L, %L)]', '{abc,b,""}' ) ok 9 - trunklet.execute_into( 'test template', '{a}' ) ok 10 - trunklet.execute_into( 'test template', '1', '{a}' ) ok 11 - trunklet.execute_into( 'test template', '2', '{abc,b,""}' ) ok 12 - trunklet.execute_into( , '{a}' ) ok 13 - trunklet.execute_into( , '{abc,b,""}' ) ok 14 - Change back to original role ok 15 - Revoke test role USAGE on test schema ok 16 - Drop test role 1..16 ok 4 - _trunklet_test.test_execute_into # Subtest: _trunklet_test.test_extract_parameters() ok 1 - Create test role ok 2 - Grant test role USAGE on test schema ok 3 - Change to test role ok 4 - Verify role change ok 5 ok 6 - test extract of json values ok 7 - Change back to original role ok 8 - Revoke test role USAGE on test schema ok 9 - Drop test role 1..9 ok 5 - _trunklet_test.test_extract_parameters # Subtest: _trunklet_test.test_language__get_id() ok 1 - language__get_id: returns correct id ok 2 - language__get_id: throws language not found 1..2 ok 6 - _trunklet_test.test_language__get_id # Subtest: _trunklet_test.test_process() ok 1 ok 2 - trunklet.process(): invalid language ok 3 - trunklet.process(): invalid parameter ok 4 - Create test view ok 5 - Create predefined templates ok 6 - Create test role ok 7 - Grant test role USAGE on test schema ok 8 - Change to test role ok 9 - Verify role change ok 10 - trunklet.process_language( ..., '%s', '{a}' ) ok 11 - trunklet.process_language( ..., '%s %s', '{a,b}' ) ok 12 - trunklet.process_language( ..., '%s %s', '{a,NULL}' ) ok 13 - trunklet.process_language( ..., '%s', '{NULL}' ) ok 14 - trunklet.process_language( ..., 'moo', NULL ) ok 15 - trunklet.process( 'test template', '{a}' ) ok 16 - trunklet.process( 'test template', '1', '{a}' ) ok 17 - trunklet.process( 'test template', '2', '{a,b}' ) ok 18 - trunklet.process( 'test template', '3', '{a,NULL}' ) ok 19 - trunklet.process( 'test template', '4', '{NULL}' ) ok 20 - trunklet.process( 'test template', '5', NULL ) ok 21 - trunklet.process( , '{a}' ) ok 22 - trunklet.process( , '{a,b}' ) ok 23 - trunklet.process( , '{a,NULL}' ) ok 24 - trunklet.process( , '{NULL}' ) ok 25 - trunklet.process( , NULL ) ok 26 - Change back to original role ok 27 - Revoke test role USAGE on test schema ok 28 - Drop test role 1..28 ok 7 - _trunklet_test.test_process # Subtest: _trunklet_test.test_schemas() ok 1 - Role public should be granted USAGE on schema trunklet ok 2 - Role public should be granted no privileges on schema _trunklet ok 3 - Role trunklet__dependency should be granted USAGE on schema _trunklet ok 4 - Role public should be granted USAGE on schema _trunklet_functions 1..4 ok 8 - _trunklet_test.test_schemas # Subtest: _trunklet_test.test_secdef_privs() ok 1 - Verify acl for trunklet.extract_parameters(character varying,anyelement,text[]) ok 2 - Verify acl for trunklet.process(integer,anyelement) ok 3 - Verify acl for trunklet.process(text,integer,anyelement) ok 4 - Verify acl for trunklet.process_language(character varying,text,anyelement) ok 5 - Verify acl for trunklet.template__add(character varying,text,integer,text) ok 6 - Verify acl for trunklet.template__remove(integer) ok 7 - Verify acl for trunklet.template__remove(text,integer) ok 8 - Verify search_path for trunklet.extract_parameters(character varying,anyelement,text[]) ok 9 - Verify search_path for trunklet.process(integer,anyelement) ok 10 - Verify search_path for trunklet.process(text,integer,anyelement) ok 11 - Verify search_path for trunklet.process_language(character varying,text,anyelement) ok 12 - Verify search_path for trunklet.template__add(character varying,text,integer,text) ok 13 - Verify search_path for trunklet.template__remove(integer) ok 14 - Verify search_path for trunklet.template__remove(text,integer) 1..14 ok 9 - _trunklet_test.test_secdef_privs # Subtest: _trunklet_test.test_template__add() ok 1 - Bogus language throws error not ok 2 - template__add: throw error when given bad template type # TODO Need to implement template type enforcement # Failed (TODO) test 2: "template__add: throw error when given bad template type" # caught: 3F000: schema "variant" does not exist # wanted: 12345 ok 3 - Verify template__add results 1..3 ok 10 - _trunklet_test.test_template__add # Subtest: _trunklet_test.test_template__dependency() ok 1 - threw with proper context 42P01: relation "bogus_table" does not exist ok 2 - dependency__add: column does not exist ok 3 - dependency__add: insufficient privilege ok 4 - dependency__add: success ok 5 - _trunklet_test.test_dependency(test_template_id) should reference _trunklet.template(template_id) ok 6 - dependency__remove: success ok 7 - FK does not exist ok 8 - dependency__remove: constraint does not exist ok 9 - dependency__remove: undefined table ok 10 - dependency__remove: column does not exist 1..10 ok 11 - _trunklet_test.test_template__dependency # Subtest: _trunklet_test.test_template__get() ok 1 - threw P0002: template name "bogus" at version 1 not found ok 2 - threw P0002: template not found ok 3 - Verify template name with loose := true ok 4 - Verify template id with loose := true ok 5 - Check _trunklet.template__get( ..., 'test template' ) ok 6 - Check _trunklet.template__get( 'test template', 1 ) ok 7 - Check _trunklet.template__get( 'test template', 2 ) ok 8 - Check _trunklet.template__get( ) ok 9 - Check _trunklet.template__get( ) 1..9 ok 12 - _trunklet_test.test_template__get # Subtest: _trunklet_test.test_template__remove() ok 1 - Test templates removed by name/version ok 2 - Test templates removed by id 1..2 ok 13 - _trunklet_test.test_template__remove # Subtest: _trunklet_test.test_template_language() ok 1 - View trunklet.template_language should exist ok 2 - Table trunklet.template_language should have the correct columns ok 3 - Role public should be granted no privileges on table trunklet.template_language ok 4 - template_language returns same results as _trunklet.language 1..4 ok 14 - _trunklet_test.test_template_language # Subtest: _trunklet_test.test_template_language__add() ok 1 - threw 22023: language_name must not be NULL ok 2 - Verify we can create test language ok 3 - Role public should be granted no privileges on function trunklet.template_language__add(character varying(100), regtype, regtype, text, text, text, text) 1..3 ok 15 - _trunklet_test.test_template_language__add # Subtest: _trunklet_test.test_template_language__remove() ok 1 - non-existent language NAME fails ok 2 - non-existent language ID fails ok 3 - Ensure there are no language functions to start with ok 4 - Verify v_language_id is good ok 5 - verify language functions exist ok 6 - DROP FUNCTION _trunklet_functions.language_id_0000000015__extract_parameters(text[],text[]) lives ok 7 - SELECT trunklet.template_language__remove('Our internal text test language', ignore_missing_functions => TRUE) lives ok 8 - SELECT trunklet.template_language__remove('Our internal text test language') lives ok 9 - Schema _trunklet_functions should have the correct functions ok 10 - Verify v_language_id is good ok 11 - verify language functions exist ok 12 - DROP FUNCTION _trunklet_functions.language_id_0000000017__extract_parameters(text[],text[]) lives ok 13 - SELECT trunklet.template_language__remove(17, ignore_missing_functions => TRUE) lives ok 14 - Add dependency from test table to template table ok 15 - Removing a language that has templates should fail ok 16 - Removing a language with cascade should fail if other things reference the templates. ok 17 - SELECT trunklet.template_language__remove('Our internal text test language', TRUE) lives 1..17 ok 16 - _trunklet_test.test_template_language__remove 1..16