Skip to content

Commit

Permalink
LDEV-4591 improve s3 test, disable backblaze
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Aug 15, 2023
1 parent 33c9d31 commit 43c5ff5
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions test/functions/S3functions.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,17 @@
---><cfscript>
component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {

public function setUp(){
/* note, we're testing a range of s3 functions in a single test so we can re-use buckets,
rather than creating and deleting lots of buckets with a test suite for each individual s3Function
*/
var s3 = getCredentials("s3");
if ( isEmpty( s3 ) )
return;
variables.bucket = s3.bucket_prefix & "s3func1-#lcase(hash(CreateGUID()))#";
variables.bucket2 = s3.bucket_prefix & "s3func2-#lcase(hash(CreateGUID()))#";

variables.dir = "s3://#bucket#";
variables.dir2 = "s3://#bucket2#";
}
/* note, we're testing a range of s3 functions in a single test so we can re-use buckets,
rather than creating and deleting lots of buckets with a test suite for each individual s3Function
*/

public void function testS3functions() skip="isNotSupported"{
var s3=getCredentials("s3");
application action="update" s3={
accessKeyId: s3.ACCESS_KEY_ID,
awsSecretKey: s3.SECRET_KEY
};
testfunctions("s3");
testfunctions("s3", s3);
}

public void function testS3functionsCustom() skip="isNotSupportedCustom"{
Expand All @@ -49,7 +39,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {
awsSecretKey: s3.SECRET_KEY,
host: s3.HOST
};
testfunctions("s3_custom");
testfunctions("s3_custom", s3);
}

public void function testS3functionsGoogle() skip="isNotSupportedGoogle"{
Expand All @@ -59,7 +49,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {
awsSecretKey: s3.SECRET_KEY,
host: s3.HOST
};
testfunctions("s3_google");
testfunctions("s3_google", s3);
}

public void function testS3functionsBackBlaze() skip="isNotSupportedBackblaze"{
Expand All @@ -69,16 +59,23 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" {
awsSecretKey: s3.SECRET_KEY,
host: s3.HOST
};
testfunctions("s3_backblaze");
return; // backblaze doesn't support deleting for 24 hours due to versioning
testfunctions("s3_backblaze", s3);
}

private function testfunctions() localMode=true {
private function testfunctions(service, s3) localMode=true {

variables.bucket = s3.bucket_prefix & "s3func1-#lcase(hash(CreateGUID()))#";
variables.bucket2 = s3.bucket_prefix & "s3func2-#lcase(hash(CreateGUID()))#";

variables.dir = "s3://#bucket#";
variables.dir2 = "s3://#bucket2#";

if ( directoryExists( dir ) )
if ( directoryExists( dir ) )
directoryDelete( dir, true );
directoryCreate( dir );

if ( directoryExists( dir2 ) )
if ( directoryExists( dir2 ) )
directoryDelete( dir2, true );
directoryCreate( dir2 );

Expand Down

0 comments on commit 43c5ff5

Please sign in to comment.