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

LDEV-5236 better debug for failing test #2465

Merged
merged 1 commit into from
Jan 3, 2025
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 @@ -198,6 +198,7 @@ jobs:
sudo -u postgres psql -c 'create database lucee;'
sudo -u postgres psql -c "create user lucee with encrypted password 'lucee'";
sudo -u postgres psql -c 'grant all privileges on database lucee to lucee;'
sudo -u postgres psql -c 'grant all on schema public to lucee;' -d lucee
- name: Start MongoDB (docker)
uses: supercharge/[email protected]
with:
Expand Down
114 changes: 60 additions & 54 deletions test/tags/dbInfo.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" {
createSchema( ds, dbtype, prefix );

describe( title="Test suite for DBINFO, db: [#dbType#]", body=function() {

it(title = "dbinfo columns [#dbType#]",
data = { prefix: prefix, ds: ds, dbtype: dbtype },
body = function( data ) {
Expand Down Expand Up @@ -167,75 +168,80 @@ component extends="org.lucee.cfml.test.LuceeTestCase" {

private void function createSchema( struct ds, string dbType, string prefix, boolean onlyDrop=false ){

try {

if (arguments.dbtype eq "oracle") { // oracle doesn't support the IF EXISTS syntax
try {
if (arguments.dbtype eq "oracle") { // oracle doesn't support the IF EXISTS syntax
try {
query datasource=arguments.ds {
echo("DROP view #arguments.prefix#v_users");
}
} catch(e){
//
}
try {
query datasource=arguments.ds {
echo("DROP TABLE #arguments.prefix#users");
}
} catch(e){
//
}
try {
query datasource=arguments.ds {
echo("DROP TABLE #arguments.prefix#roles");
}
} catch(e){
//
}
} else {
query datasource=arguments.ds {
echo("DROP view #arguments.prefix#v_users");
echo("DROP view IF EXISTS #arguments.prefix#v_users");
}
} catch(e){
//
}
try {
query datasource=arguments.ds {
echo("DROP TABLE #arguments.prefix#users");
echo("DROP TABLE IF EXISTS #arguments.prefix#users");
}
} catch(e){
//
}
try {
query datasource=arguments.ds {
echo("DROP TABLE #arguments.prefix#roles");
echo("DROP TABLE IF EXISTS #arguments.prefix#roles");
}
} catch(e){
//
}
} else {

if ( arguments.onlyDrop )
return;

query datasource=arguments.ds {
echo("CREATE TABLE #arguments.prefix#roles (
role_id INT,
role_name VARCHAR(100) DEFAULT NULL,
CONSTRAINT PK_#arguments.prefix#roles PRIMARY KEY ( role_id )
)");
}
query datasource=arguments.ds {
echo("DROP view IF EXISTS #arguments.prefix#v_users");
echo("CREATE TABLE #arguments.prefix#users (
user_id VARCHAR(50) NOT NULL,
user_name VARCHAR(50) NOT NULL,
role_id INT DEFAULT NULL,
CONSTRAINT PK_#arguments.prefix#users PRIMARY KEY ( user_id )
)");
}
query datasource=arguments.ds {
echo("DROP TABLE IF EXISTS #arguments.prefix#users");
echo("ALTER TABLE #arguments.prefix#users
ADD CONSTRAINT fk_#arguments.prefix#_user_role_id
FOREIGN KEY (role_id)
REFERENCES #arguments.prefix#roles ( role_id )");
}
query datasource=arguments.ds {
echo("DROP TABLE IF EXISTS #arguments.prefix#roles");
echo("CREATE INDEX idx_#arguments.prefix#_users_role_id ON #arguments.prefix#users(role_id)");
}
}

if ( arguments.onlyDrop )
return;

query datasource=arguments.ds {
echo("CREATE TABLE #arguments.prefix#roles (
role_id INT,
role_name VARCHAR(100) DEFAULT NULL,
CONSTRAINT PK_#arguments.prefix#roles PRIMARY KEY ( role_id )
)");
}
query datasource=arguments.ds {
echo("CREATE TABLE #arguments.prefix#users (
user_id VARCHAR(50) NOT NULL,
user_name VARCHAR(50) NOT NULL,
role_id INT DEFAULT NULL,
CONSTRAINT PK_#arguments.prefix#users PRIMARY KEY ( user_id )
)");
}
query datasource=arguments.ds {
echo("ALTER TABLE #arguments.prefix#users
ADD CONSTRAINT fk_#arguments.prefix#_user_role_id
FOREIGN KEY (role_id)
REFERENCES #arguments.prefix#roles ( role_id )");
}
query datasource=arguments.ds {
echo("CREATE INDEX idx_#arguments.prefix#_users_role_id ON #arguments.prefix#users(role_id)");
}

query datasource=arguments.ds {
echo("CREATE VIEW #arguments.prefix#v_users AS
SELECT u.user_id, u.user_name, r.role_id, r.role_name
FROM #arguments.prefix#users u, #arguments.prefix#roles r
WHERE r.role_id = u.role_id
");
query datasource=arguments.ds {
echo("CREATE VIEW #arguments.prefix#v_users AS
SELECT u.user_id, u.user_name, r.role_id, r.role_name
FROM #arguments.prefix#users u, #arguments.prefix#roles r
WHERE r.role_id = u.role_id
");
}
} catch (any e){
systemOutput( "Error creating schema for #arguments.dbtype#: #e.message#", true );
rethrow;
}
/*
query name="local.tables" params={ table: arguments.prefix & "%" } datasource=arguments.ds {
Expand Down
Loading