Skip to content

Commit

Permalink
Merge 11c0752 into e5ec54c
Browse files Browse the repository at this point in the history
  • Loading branch information
jgebal committed Jun 21, 2019
2 parents e5ec54c + 11c0752 commit 988518b
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 94 deletions.
90 changes: 59 additions & 31 deletions .travis/install.sh
Expand Up @@ -5,6 +5,7 @@ set -ev

#install core of utplsql
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
whenever sqlerror exit failure rollback
set feedback off
set verify off
Expand Down Expand Up @@ -57,46 +58,73 @@ SQL

fi

#additional privileges to run scripted tests
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback on
--needed for Mystats script to work
grant select any dictionary to $UT3_OWNER;
--Needed for testing a coverage outside ut3_owner.
grant create any procedure, drop any procedure, execute any procedure to $UT3_OWNER;
SQL

#Create user that will own the tests that are relevant to internal framework
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
@create_utplsql_owner.sql $UT3_TESTER $UT3_TESTER_PASSWORD $UT3_TABLESPACE
--needed for disabling DDL trigger and testint parser without trigger enabled/present
grant alter any trigger to ut3_tester;
whenever sqlerror exit failure rollback
--------------------------------------------------------------------------------
PROMPT Adding back create-trigger privilege to $UT3_OWNER for testing
grant administer database trigger to $UT3_OWNER;
--------------------------------------------------------------------------------
PROMPT Creating $UT3_TESTER - Power-user for testing internal framework code
create user $UT3_TESTER identified by "$UT3_TESTER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
grant create session, create procedure, create type, create table to $UT3_TESTER;
PROMPT Additional grants for disabling DDL trigger and testing parser without trigger enabled/present
grant alter any trigger to $UT3_TESTER;
grant administer database trigger to $UT3_TESTER;
exit
SQL
grant execute on dbms_lock to $UT3_TESTER;
#Create additional UT3$USER# to test for special characters and front end API testing
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
@create_utplsql_owner.sql $UT3_USER $UT3_USER_PASSWORD $UT3_TABLESPACE
--Grant UT3 framework to min user
@create_user_grants.sql $UT3_OWNER $UT3_USER
exit
SQL
PROMPT Granting $UT3_OWNER code to $UT3_TESTER
#Create additional UT3_TESTER_HELPER that will provide a functions to allow min grant test user setup test
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
set feedback off
@create_utplsql_owner.sql $UT3_TESTER_HELPER $UT3_TESTER_HELPER_PASSWORD $UT3_TABLESPACE
--needed for testing distributed transactions
begin
for i in (
select object_name from all_objects t
where t.object_type in ('PACKAGE','TYPE')
and owner = 'UT3'
and generated = 'N'
and object_name not like 'SYS%')
loop
execute immediate 'grant execute on ut3."'||i.object_name||'" to UT3_TESTER';
end loop;
end;
/
PROMPT Granting $UT3_OWNER tables to $UT3_TESTER
begin
for i in ( select table_name from all_tables t where owner = 'UT3' and nested = 'NO' and IOT_TYPE is NULL)
loop
execute immediate 'grant select on UT3.'||i.table_name||' to UT3_TESTER';
end loop;
end;
/
--------------------------------------------------------------------------------
PROMPT Creating $UT3_USER - minimal privileges user for API testing
create user $UT3_USER identified by "$UT3_USER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
grant create session, create procedure, create type, create table to $UT3_USER;
--------------------------------------------------------------------------------
PROMPT Creating $UT3_TESTER_HELPER - provides functions to allow min grant test user setup tests.
create user $UT3_TESTER_HELPER identified by "$UT3_TESTER_HELPER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
grant create session, create procedure, create type, create table to $UT3_TESTER_HELPER;
PROMPT Grants for testing distributed transactions
grant create public database link to $UT3_TESTER_HELPER;
grant drop public database link to $UT3_TESTER_HELPER;
set feedback on
--Needed for testing coverage outside of main UT3 schema.
PROMPT Grants for testing coverage outside of main UT3 schema.
grant create any procedure, drop any procedure, execute any procedure, create any type, drop any type, execute any type, under any type, select any table, update any table, insert any table, delete any table, create any table, drop any table, alter any table, select any dictionary, create any synonym, drop any synonym to $UT3_TESTER_HELPER;
grant create job to $UT3_TESTER_HELPER;
--Needed to allow for enable/disable of annotation triggers
grant administer database trigger to $UT3_TESTER_HELPER;
exit
SQL
2 changes: 1 addition & 1 deletion source/create_utplsql_owner.sql
Expand Up @@ -29,7 +29,7 @@ prompt Creating utPLSQL user &&ut3_user

create user &ut3_user identified by "&ut3_password" default tablespace &ut3_tablespace quota unlimited on &ut3_tablespace;

grant create session, create sequence, create procedure, create type, create table, create view, create synonym, administer database trigger to &ut3_user;
grant create session, create sequence, create procedure, create type, create table, create view, create synonym to &ut3_user;

begin
$if dbms_db_version.version < 18 $then
Expand Down
4 changes: 3 additions & 1 deletion source/install_ddl_trigger.sql
Expand Up @@ -18,5 +18,7 @@
@@define_ut3_owner_param.sql

@@check_sys_grants.sql "'ADMINISTER DATABASE TRIGGER','CREATE TRIGGER'"
@@install_component.sql 'core/annotations/ut_trigger_annotation_parsing.trg'

grant administer database trigger to &&ut3_owner;
@@install_component.sql 'core/annotations/ut_trigger_annotation_parsing.trg'
revoke administer database trigger from &&ut3_owner;
2 changes: 1 addition & 1 deletion source/install_headless_with_trigger.sql
Expand Up @@ -21,6 +21,6 @@
@@install.sql &&ut3_owner
@@create_synonyms_and_grants_for_public.sql &&ut3_owner

@@install_ddl_trigger.sql
@@install_ddl_trigger.sql &&ut3_owner

exit
2 changes: 0 additions & 2 deletions source/uninstall_objects.sql
Expand Up @@ -174,8 +174,6 @@ drop table ut_compound_data_diff_tmp purge;

drop table ut_json_data_diff_tmp;

drop trigger ut_trigger_annotation_parsing;

drop package ut_annotation_manager;

drop package ut_annotation_parser;
Expand Down
35 changes: 0 additions & 35 deletions test/grant_ut3_owner_to_ut3_tester.sql

This file was deleted.

25 changes: 2 additions & 23 deletions test/install_and_run_tests.sh
Expand Up @@ -3,28 +3,7 @@ set -ev

#goto git root directory
git rev-parse && cd "$(git rev-parse --show-cdup)"

cd test

time "$SQLCLI" sys/${ORACLE_PWD}@//${CONNECTION_STR} AS SYSDBA @grant_ut3_owner_to_ut3_tester.sql

time "$SQLCLI" ${UT3_TESTER_HELPER}/${UT3_TESTER_HELPER_PASSWORD}@//${CONNECTION_STR} @install_ut3_tester_helper.sql

time "$SQLCLI" ${UT3_USER}/${UT3_USER_PASSWORD}@//${CONNECTION_STR} @install_ut3_user_tests.sql

time "$SQLCLI" ${UT3_TESTER}/${UT3_TESTER_PASSWORD}@//${CONNECTION_STR} @install_ut3_tester_tests.sql

cd ..

time utPLSQL-cli/bin/utplsql run ${UT3_TESTER_HELPER}/${UT3_TESTER_HELPER_PASSWORD}@${CONNECTION_STR} \
-source_path=source -owner=ut3 \
-p='ut3_tester,ut3$user#' \
-test_path=test -c \
-f=ut_coverage_sonar_reporter -o=coverage.xml \
-f=ut_coverage_cobertura_reporter -o=cobertura.xml \
-f=ut_coverage_html_reporter -o=coverage.html \
-f=ut_coveralls_reporter -o=coverage.json \
-f=ut_sonar_test_reporter -o=test_results.xml \
-f=ut_junit_reporter -o=junit_test_results.xml \
-f=ut_tfs_junit_reporter -o=tfs_test_results.xml \
-f=ut_documentation_reporter -o=test_results.log -s
time . ./${DIR}/install_tests.sh
time . ./${DIR}/run_tests.sh
13 changes: 13 additions & 0 deletions test/install_tests.sh
@@ -0,0 +1,13 @@
#!/bin/bash
set -ev

#goto git root directory
git rev-parse && cd "$(git rev-parse --show-cdup)"
cd test

"$SQLCLI" ${UT3_TESTER_HELPER}/${UT3_TESTER_HELPER_PASSWORD}@//${CONNECTION_STR} @install_ut3_tester_helper.sql

"$SQLCLI" ${UT3_USER}/${UT3_USER_PASSWORD}@//${CONNECTION_STR} @install_ut3_user_tests.sql

"$SQLCLI" ${UT3_TESTER}/${UT3_TESTER_PASSWORD}@//${CONNECTION_STR} @install_ut3_tester_tests.sql

18 changes: 18 additions & 0 deletions test/run_tests.sh
@@ -0,0 +1,18 @@
#!/bin/bash
set -ev

#goto git root directory
git rev-parse && cd "$(git rev-parse --show-cdup)"

time utPLSQL-cli/bin/utplsql run ${UT3_TESTER_HELPER}/${UT3_TESTER_HELPER_PASSWORD}@${CONNECTION_STR} \
-source_path=source -owner=ut3 \
-p='ut3_tester,ut3$user#' \
-test_path=test -c \
-f=ut_coverage_sonar_reporter -o=coverage.xml \
-f=ut_coverage_cobertura_reporter -o=cobertura.xml \
-f=ut_coverage_html_reporter -o=coverage.html \
-f=ut_coveralls_reporter -o=coverage.json \
-f=ut_sonar_test_reporter -o=test_results.xml \
-f=ut_junit_reporter -o=junit_test_results.xml \
-f=ut_tfs_junit_reporter -o=tfs_test_results.xml \
-f=ut_documentation_reporter -o=test_results.log -s

0 comments on commit 988518b

Please sign in to comment.