Skip to content

Commit

Permalink
LDEV-5187 improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Dec 10, 2024
1 parent 1b68532 commit ce19f78
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions test/tickets/LDEV5187.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -130,29 +130,38 @@ component extends="org.lucee.cfml.test.LuceeTestCase" {
it(title = "check query error listener scopes, async=true", skip=true, body = function( currentSpec ) {
var q = queryNew("a");
application name="ldev5187";
request.ldev5187 = true;
application.ldev5187 = true;
// test will pass if application name is ""
application name=""; // query listener gets the default name="" application scope
// but this will cause the test to fail
// application name="ldev5187";

request.ldev5187 = false;
application.ldev5187 = false;
server.ldev5187_applicationName = "";
query async=true name="local.qry" dbtype="query"
listener={
error=function (caller,args) {
systemOutput("In async error listener has scopes", true);
//systemOutput("In async error listener has scopes", true);
if (!structKeyExists( request, "ldev5187" ) ){
systemOutput("Bad! async error listener missing request scope", true);
//systemOutput("Bad! async error listener missing request scope", true);
throw "missing request scope";
}
if (!structKeyExists( application, "ldev5187" ) ) {
server.ldev5187_applicationName = getApplicationSettings().name;
systemOutput("Bad! async error listener missing correct application scope [#server.ldev5187_applicationName#]", true);
//systemOutput("Bad! async error listener missing correct application scope [#server.ldev5187_applicationName#]", true);
throw "missing application scope";
}
systemOutput("Good! async error listener has scopes", true);
//systemOutput("Good! async error listener has scopes", true);
request.ldev5187 = true;
application.ldev5187 = true;
}
} {
echo("select a from missing");
};
sleep(200);
expect( server.ldev5187_applicationName ).toBe( "ldev5187" );
sleep( 200 );
expect( server.ldev5187_applicationName ).toBe( getApplicationSettings().name );
// expect( request.ldev5187 ).toBeTrue(); request scope isn't propagated back, to be expected for async
expect( application.ldev5187 ).toBeTrue();
structDelete( request, "ldev5187");
structDelete( application, "ldev5187");
structDelete( server, "ldev5187_applicationName");
Expand Down

0 comments on commit ce19f78

Please sign in to comment.