Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add basic open cursor test #5

Merged
merged 1 commit into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ jobs:
ORACLE_PASSWORD: lucee_oracle
ORACLE_PORT: 1521
ORACLE_DATABASE: XEPDB1
ORACLE_SYSTEM_PASSWORD: lucee_system
43 changes: 43 additions & 0 deletions tests/cursors.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="oracle" {
function run(){
describe( title="check open cursors", skip=doSkip(),body=function(){
it(title="Checking oracle query to select current Date & time", body=function(){
systemOutput("", true);
var initial_cursor = checkCursors();
systemOutput(initial_cursor, true);

// do some stuff to reproduce the cursor problem

var post_cursor = checkCursors();
systemOutput(post_cursor, true);

expect( initial_cursor.highest_open_cur ).toBe( post_cursor.highest_open_cur );
});
});
}

private query function checkCursors(){
var ds = server.getDatasource("oracle");
var sys_password = server._getSystemPropOrEnvVars( "SYSTEM_PASSWORD", "ORACLE_" );
if ( structCount( sys_password ) eq 0 )
throw "missing env var: [ORACLE_SYSTEM_PASSWORD]";
ds.password = sys_password.SYSTEM_PASSWORD;
ds.username = "sys as sysdba";

var cursors = queryExecute(
"SELECT max(a.value) as highest_open_cur, p.value as max_open_cur
FROM v$sesstat a, v$statname b, v$parameter p
WHERE a.statistic## = b.statistic##
and b.name = 'opened cursors current'
and p.name= 'open_cursors'
group by p.value",
{},
{datasource=ds}
);
return cursors;
}

private boolean function doSkip() {
return structCount(server.getDatasource("oracle"))==0;
}
}