Skip to content

Commit

Permalink
improve test case
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Nov 8, 2023
1 parent 650c6f7 commit 876ba12
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions tests/general/BigBucket.cfc
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {
function run( testResults , testBox ) {

describe( title="Test suite for big buckets",skip=isNotSupported(), body=function() {
cred=getCredentials();
describe( title="Test suite for big buckets",skip=Util::isAWSNotSupported(), body=function() {
var cred=Util::getAWSCredentials()
var bucketName=cred.PREFIX&"-big"&listFirst(replace(server.lucee.version,".","","all"),"-");



// does the bucket exists?
if(!S3Exists(
bucketName:bucketName,
Expand Down Expand Up @@ -34,9 +32,9 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {
}
}

it(title="checking with S3ListBucket", skip=isNotSupported(), body = function( currentSpec ) {
var cred=getCredentials();
it(title="checking with S3ListBucket", skip=Util::isAWSNotSupported(), body = function( currentSpec ) {
var cred=Util::getAWSCredentials()

if(records==0){
var executionTime=getTickCount();
var qry=S3ListBucket(
Expand All @@ -50,16 +48,5 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {
});
}

private boolean function isNotSupported() {
res= getCredentials();
return isNull(res) || len(res)==0;
}
private struct function getCredentials() {
var ACCESS_KEY_ID=server.system.environment.S3_ACCESS_ID_TEST?:nullValue();
if(isNull(ACCESS_KEY_ID) || isEmpty(ACCESS_KEY_ID)) return {};
var SECRET_KEY=server.system.environment.S3_SECRET_KEY_TEST?:nullValue();
if(isNull(SECRET_KEY) || isEmpty(SECRET_KEY)) return {};

return {ACCESS_KEY_ID:ACCESS_KEY_ID,SECRET_KEY:SECRET_KEY};
}
}

0 comments on commit 876ba12

Please sign in to comment.