From 43c5ff50e00c2e4cf72a773eca08c529d8bd83ff Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Tue, 15 Aug 2023 09:53:54 +0200 Subject: [PATCH] LDEV-4591 improve s3 test, disable backblaze --- test/functions/S3functions.cfc | 37 ++++++++++++++++------------------ 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/test/functions/S3functions.cfc b/test/functions/S3functions.cfc index 5fec64d9f2..150f9555a6 100644 --- a/test/functions/S3functions.cfc +++ b/test/functions/S3functions.cfc @@ -19,19 +19,9 @@ ---> 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"); @@ -39,7 +29,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" { accessKeyId: s3.ACCESS_KEY_ID, awsSecretKey: s3.SECRET_KEY }; - testfunctions("s3"); + testfunctions("s3", s3); } public void function testS3functionsCustom() skip="isNotSupportedCustom"{ @@ -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"{ @@ -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"{ @@ -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 );