Skip to content

Commit 8b53736

Browse files
authored
Merge pull request #1185 from utPLSQL/feature/publish_test_results_in_pr
Improvements to build process and build on 12.1EE image
2 parents 8c91c7b + af0b0bb commit 8b53736

File tree

8 files changed

+262
-207
lines changed

8 files changed

+262
-207
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
5+
cd ${SCRIPT_DIR}/../../source
6+
7+
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
8+
set feedback off
9+
whenever sqlerror exit failure rollback
10+
11+
--------------------------------------------------------------------------------
12+
PROMPT Adding back create-trigger privilege to $UT3_DEVELOP_SCHEMA for testing
13+
grant administer database trigger to $UT3_DEVELOP_SCHEMA;
14+
15+
--------------------------------------------------------------------------------
16+
PROMPT Creating $UT3_TESTER - Power-user for testing internal framework code
17+
18+
create user $UT3_TESTER identified by "$UT3_TESTER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
19+
grant create session, create procedure, create type, create table to $UT3_TESTER;
20+
21+
grant execute on dbms_lock to $UT3_TESTER;
22+
23+
PROMPT Granting $UT3_DEVELOP_SCHEMA code to $UT3_TESTER
24+
25+
begin
26+
for i in (
27+
select object_name from all_objects t
28+
where t.object_type in ('PACKAGE','TYPE')
29+
and owner = '$UT3_DEVELOP_SCHEMA'
30+
and generated = 'N'
31+
and object_name not like 'SYS%')
32+
loop
33+
execute immediate 'grant execute on $UT3_DEVELOP_SCHEMA."'||i.object_name||'" to $UT3_TESTER';
34+
end loop;
35+
end;
36+
/
37+
38+
PROMPT Granting $UT3_DEVELOP_SCHEMA tables to $UT3_TESTER
39+
40+
begin
41+
for i in ( select table_name from all_tables t where owner = '$UT3_DEVELOP_SCHEMA' and nested = 'NO' and iot_name is null)
42+
loop
43+
execute immediate 'grant select on $UT3_DEVELOP_SCHEMA.'||i.table_name||' to $UT3_TESTER';
44+
end loop;
45+
end;
46+
/
47+
48+
49+
--------------------------------------------------------------------------------
50+
PROMPT Creating $UT3_USER - minimal privileges user for API testing
51+
52+
create user $UT3_USER identified by "$UT3_USER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
53+
grant create session, create procedure, create type, create table to $UT3_USER;
54+
55+
PROMPT Grants for starting a debugging session from $UT3_USER
56+
grant debug connect session to $UT3_USER;
57+
grant debug any procedure to $UT3_USER;
58+
begin
59+
\$if dbms_db_version.version <= 11 \$then
60+
null; -- no addition action necessary
61+
\$else
62+
-- necessary on 12c or higher
63+
dbms_network_acl_admin.append_host_ace (
64+
host =>'*',
65+
ace => sys.xs\$ace_type(
66+
privilege_list => sys.xs\$name_list('JDWP') ,
67+
principal_name => '$UT3_USER',
68+
principal_type => sys.xs_acl.ptype_db
69+
)
70+
);
71+
\$end
72+
end;
73+
/
74+
75+
--------------------------------------------------------------------------------
76+
PROMPT Creating $UT3_TESTER_HELPER - provides functions to allow min grant test user setup tests.
77+
78+
create user $UT3_TESTER_HELPER identified by "$UT3_TESTER_HELPER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
79+
grant create session, create procedure, create type, create table to $UT3_TESTER_HELPER;
80+
81+
PROMPT Grants for testing distributed transactions
82+
grant create public database link to $UT3_TESTER_HELPER;
83+
grant drop public database link to $UT3_TESTER_HELPER;
84+
85+
PROMPT Grants for testing coverage outside of main $UT3_DEVELOP_SCHEMA schema.
86+
grant create any procedure, drop any procedure, execute any procedure, create any type, drop any type, execute any type, under any type,
87+
select any table, update any table, insert any table, delete any table, create any table, drop any table, alter any table,
88+
select any dictionary, create any synonym, drop any synonym,
89+
grant any object privilege, grant any privilege, create public synonym, drop public synonym, create any trigger
90+
to $UT3_TESTER_HELPER;
91+
92+
grant create job to $UT3_TESTER_HELPER;
93+
94+
PROMPT Additional grants for disabling DDL trigger and testing parser without trigger enabled/present
95+
96+
grant alter any trigger to $UT3_TESTER_HELPER;
97+
grant administer database trigger to $UT3_TESTER_HELPER;
98+
grant execute on dbms_lock to $UT3_TESTER_HELPER;
99+
100+
create user ut3_cache_test_owner identified by ut3;
101+
grant create session, create procedure to ut3_cache_test_owner;
102+
103+
create user ut3_no_extra_priv_user identified by ut3;
104+
grant create session, create procedure to ut3_no_extra_priv_user;
105+
106+
create user ut3_select_catalog_user identified by ut3;
107+
grant create session, create procedure, select_catalog_role to ut3_select_catalog_user;
108+
109+
create user ut3_select_any_table_user identified by ut3;
110+
grant create session, create procedure, select any table to ut3_select_any_table_user;
111+
112+
create user ut3_execute_any_proc_user identified by ut3;
113+
grant create session, create procedure, execute any procedure to ut3_execute_any_proc_user;
114+
exit
115+
SQL

.github/scripts/install.sh

Lines changed: 0 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -19,158 +19,3 @@ set verify off
1919
alter session set plsql_optimize_level=0;
2020
@${INSTALL_FILE} $UT3_DEVELOP_SCHEMA $UT3_DEVELOP_SCHEMA_PASSWORD
2121
SQL
22-
23-
if [[ "${MATRIX_JOB_ID}" == 1 ]]; then
24-
25-
#check code-style for errors
26-
time "$SQLCLI" $UT3_DEVELOP_SCHEMA/$UT3_DEVELOP_SCHEMA_PASSWORD@//$CONNECTION_STR @../development/utplsql_style_check.sql
27-
28-
#test install/uninstall process
29-
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
30-
set feedback off
31-
set verify off
32-
whenever sqlerror exit failure rollback
33-
34-
@uninstall_all.sql $UT3_DEVELOP_SCHEMA
35-
whenever sqlerror exit failure rollback
36-
declare
37-
v_leftover_objects_count integer;
38-
begin
39-
select sum(cnt)
40-
into v_leftover_objects_count
41-
from (
42-
select count(1) cnt from dba_objects where owner = '$UT3_DEVELOP_SCHEMA'
43-
where object_name not like 'PLSQL_PROFILER%' and object_name not like 'DBMSPCC_%'
44-
union all
45-
select count(1) cnt from dba_synonyms where table_owner = '$UT3_DEVELOP_SCHEMA'
46-
where table_name not like 'PLSQL_PROFILER%' and table_name not like 'DBMSPCC_%'
47-
);
48-
if v_leftover_objects_count > 0 then
49-
raise_application_error(-20000, 'Not all objects were successfully uninstalled - leftover objects count='||v_leftover_objects_count);
50-
end if;
51-
end;
52-
/
53-
SQL
54-
55-
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
56-
set feedback off
57-
set verify off
58-
59-
alter session set plsql_optimize_level=0;
60-
@install.sql $UT3_DEVELOP_SCHEMA
61-
@install_ddl_trigger.sql $UT3_DEVELOP_SCHEMA
62-
@create_synonyms_and_grants_for_public.sql $UT3_DEVELOP_SCHEMA
63-
SQL
64-
65-
fi
66-
67-
68-
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
69-
set feedback off
70-
whenever sqlerror exit failure rollback
71-
72-
--------------------------------------------------------------------------------
73-
PROMPT Adding back create-trigger privilege to $UT3_DEVELOP_SCHEMA for testing
74-
grant administer database trigger to $UT3_DEVELOP_SCHEMA;
75-
76-
--------------------------------------------------------------------------------
77-
PROMPT Creating $UT3_TESTER - Power-user for testing internal framework code
78-
79-
create user $UT3_TESTER identified by "$UT3_TESTER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
80-
grant create session, create procedure, create type, create table to $UT3_TESTER;
81-
82-
grant execute on dbms_lock to $UT3_TESTER;
83-
84-
PROMPT Granting $UT3_DEVELOP_SCHEMA code to $UT3_TESTER
85-
86-
begin
87-
for i in (
88-
select object_name from all_objects t
89-
where t.object_type in ('PACKAGE','TYPE')
90-
and owner = '$UT3_DEVELOP_SCHEMA'
91-
and generated = 'N'
92-
and object_name not like 'SYS%')
93-
loop
94-
execute immediate 'grant execute on $UT3_DEVELOP_SCHEMA."'||i.object_name||'" to $UT3_TESTER';
95-
end loop;
96-
end;
97-
/
98-
99-
PROMPT Granting $UT3_DEVELOP_SCHEMA tables to $UT3_TESTER
100-
101-
begin
102-
for i in ( select table_name from all_tables t where owner = '$UT3_DEVELOP_SCHEMA' and nested = 'NO' and iot_name is null)
103-
loop
104-
execute immediate 'grant select on $UT3_DEVELOP_SCHEMA.'||i.table_name||' to $UT3_TESTER';
105-
end loop;
106-
end;
107-
/
108-
109-
110-
--------------------------------------------------------------------------------
111-
PROMPT Creating $UT3_USER - minimal privileges user for API testing
112-
113-
create user $UT3_USER identified by "$UT3_USER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
114-
grant create session, create procedure, create type, create table to $UT3_USER;
115-
116-
PROMPT Grants for starting a debugging session from $UT3_USER
117-
grant debug connect session to $UT3_USER;
118-
grant debug any procedure to $UT3_USER;
119-
begin
120-
\$if dbms_db_version.version <= 11 \$then
121-
null; -- no addition action necessary
122-
\$else
123-
-- necessary on 12c or higher
124-
dbms_network_acl_admin.append_host_ace (
125-
host =>'*',
126-
ace => sys.xs\$ace_type(
127-
privilege_list => sys.xs\$name_list('JDWP') ,
128-
principal_name => '$UT3_USER',
129-
principal_type => sys.xs_acl.ptype_db
130-
)
131-
);
132-
\$end
133-
end;
134-
/
135-
136-
--------------------------------------------------------------------------------
137-
PROMPT Creating $UT3_TESTER_HELPER - provides functions to allow min grant test user setup tests.
138-
139-
create user $UT3_TESTER_HELPER identified by "$UT3_TESTER_HELPER_PASSWORD" default tablespace $UT3_TABLESPACE quota unlimited on $UT3_TABLESPACE;
140-
grant create session, create procedure, create type, create table to $UT3_TESTER_HELPER;
141-
142-
PROMPT Grants for testing distributed transactions
143-
grant create public database link to $UT3_TESTER_HELPER;
144-
grant drop public database link to $UT3_TESTER_HELPER;
145-
146-
PROMPT Grants for testing coverage outside of main $UT3_DEVELOP_SCHEMA schema.
147-
grant create any procedure, drop any procedure, execute any procedure, create any type, drop any type, execute any type, under any type,
148-
select any table, update any table, insert any table, delete any table, create any table, drop any table, alter any table,
149-
select any dictionary, create any synonym, drop any synonym,
150-
grant any object privilege, grant any privilege, create public synonym, drop public synonym, create any trigger
151-
to $UT3_TESTER_HELPER;
152-
153-
grant create job to $UT3_TESTER_HELPER;
154-
155-
PROMPT Additional grants for disabling DDL trigger and testing parser without trigger enabled/present
156-
157-
grant alter any trigger to $UT3_TESTER_HELPER;
158-
grant administer database trigger to $UT3_TESTER_HELPER;
159-
grant execute on dbms_lock to $UT3_TESTER_HELPER;
160-
161-
create user ut3_cache_test_owner identified by ut3;
162-
grant create session, create procedure to ut3_cache_test_owner;
163-
164-
create user ut3_no_extra_priv_user identified by ut3;
165-
grant create session, create procedure to ut3_no_extra_priv_user;
166-
167-
create user ut3_select_catalog_user identified by ut3;
168-
grant create session, create procedure, select_catalog_role to ut3_select_catalog_user;
169-
170-
create user ut3_select_any_table_user identified by ut3;
171-
grant create session, create procedure, select any table to ut3_select_any_table_user;
172-
173-
create user ut3_execute_any_proc_user identified by ut3;
174-
grant create session, create procedure, execute any procedure to ut3_execute_any_proc_user;
175-
exit
176-
SQL
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
set -ev
4+
SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
5+
cd ${SCRIPT_DIR}/../../source
6+
7+
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
8+
set feedback off
9+
set verify off
10+
whenever sqlerror exit failure rollback
11+
12+
@uninstall_all.sql $UT3_DEVELOP_SCHEMA
13+
SQL
14+
time "$SQLCLI" sys/$ORACLE_PWD@//$CONNECTION_STR AS SYSDBA <<-SQL
15+
set feedback off
16+
set verify off
17+
whenever sqlerror exit failure rollback
18+
set serverout on
19+
begin
20+
for i in (
21+
select o.object_type||' '||o.owner||'.'||o.object_name as obj
22+
from dba_objects o
23+
where owner = '$UT3_DEVELOP_SCHEMA'
24+
union all
25+
select 'SYNONYM '||s.owner||'.'||s.synonym_name||' FOR '||s.table_owner||'.'||s.table_name as obj
26+
from dba_synonyms s
27+
where table_owner = '$UT3_DEVELOP_SCHEMA'
28+
) loop
29+
dbms_output.put_line(i.obj);
30+
end loop;
31+
end;
32+
/
33+
declare
34+
v_leftover_objects_count integer;
35+
begin
36+
select sum(cnt)
37+
into v_leftover_objects_count
38+
from (
39+
select count(1) cnt from dba_objects
40+
where owner = '$UT3_DEVELOP_SCHEMA'
41+
and object_name not like 'PLSQL_PROFILER%' and object_name not like 'DBMSPCC_%'
42+
union all
43+
select count(1) cnt from dba_synonyms
44+
where table_owner = '$UT3_DEVELOP_SCHEMA'
45+
and table_name not like 'PLSQL_PROFILER%' and table_name not like 'DBMSPCC_%'
46+
);
47+
if v_leftover_objects_count > 0 then
48+
raise_application_error(-20000, 'Not all objects were successfully uninstalled - leftover objects count='||v_leftover_objects_count);
49+
end if;
50+
end;
51+
/
52+
drop user $UT3_DEVELOP_SCHEMA;
53+
SQL

0 commit comments

Comments
 (0)