Skip to content

Commit

Permalink
add load test case
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Oct 12, 2023
1 parent 724fb2c commit b2dc172
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
1 change: 0 additions & 1 deletion tests/functions/S3Copy.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {
function run( testResults , testBox ) {
describe( title="Test suite for S3Copy()", body=function() {
it(title="check with blackbaze",skip=Util::isBackBlazeNotSupported(), body = function( currentSpec ) {
throw "#structKeyList(arguments)#";
testit(Util::getBackBlazeCredentials(),"us-east-005");
});

Expand Down
41 changes: 41 additions & 0 deletions tests/general/LoadTest.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
component extends="org.lucee.cfml.test.LuceeTestCase" {

function run( testResults , testBox ) {
describe( "Loud test", function() {
it( 'make a load test', parallel);
});

}

private function parallel() threadCount=10 repetitition=2 {
var udfs=getPageContext().getUDFs();
var meta=getMetadata(udfs[len(udfs)]);

if(meta.threadcount<1 || meta.threadcount>1000) {
throw "thread count need to be a number between 1 and 1000, now it is [#meta.threadcount#]";
}
if(meta.repetitition<1 || meta.repetitition>1000) {
throw "repetitition need to be a number between 1 and 1000, now it is [#meta.repetitition#]";
}
if(meta.threadcount==1 || meta.repetitition==1) {
throw "repetitition or thread count need to be bigger than 1";

var names = [];
for (var i = 1; i <= arguments.repetitition; i++) {
for (var y = 1; y <= arguments.threadcount; y++) {
var name="testThread:#i#:#y#";
arrayAppend(names, name);
thread action="run" name=name udf=code args=arguments {
udf(argumentCollection:args);
}
}
}
thread action="join" name=arrayToList(names);

}

private function code() {
systemOutput("execute the code",1,1);
}

}

0 comments on commit b2dc172

Please sign in to comment.