From ea1d8cf7bcc308766f043a9c4b5ee0e745b2436d Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Fri, 21 Jul 2023 13:34:36 +0200 Subject: [PATCH] cleanup old tests and build --- .github/workflows/main.yml | 39 +++--- ant/build-core.xml | 1 + ant/upload-to-s3.xml | 236 +++++++----------------------------- ant/upload_to_s3.cfm | 235 +++++++++++++++++++++++++++++++++++ test/_setupTestServices.cfc | 33 ++++- test/extension/S3.cfc | 36 +++--- test/general/Resources.cfc | 6 +- test/tags/Http.cfc | 4 +- test/tickets/LDEV0359.cfc | 3 +- test/tickets/LDEV0931.cfc | 2 +- test/tickets/LDEV1116.cfc | 2 +- test/tickets/LDEV1129.cfc | 16 ++- test/tickets/LDEV1176.cfc | 5 +- test/tickets/LDEV1396.cfc | 15 +-- test/tickets/LDEV1489.cfc | 33 +++-- 15 files changed, 403 insertions(+), 263 deletions(-) create mode 100644 ant/upload_to_s3.cfm diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ffb409bd64..105f4c0870 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Build 5.3 +name: Build 5.3.9 on: workflow_call: @@ -20,7 +20,8 @@ jobs: build: runs-on: ubuntu-latest - + env: + DO_DEPLOY: "${{ github.event_name == 'push' && github.ref == 'refs/heads/5.3.9' }}" services: sql-server: image: mcr.microsoft.com/mssql/server:2019-latest @@ -32,12 +33,12 @@ jobs: - 1433:1433 options: --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P ${SA_PASSWORD} -Q 'SELECT 1' || exit 1" --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - uses: szenius/set-timezone@v1.0 + - uses: szenius/set-timezone@v1.1 with: timezoneLinux: "UTC" - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Test Java Version - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 if: ${{ inputs.LUCEE_TEST_JAVA_VERSION != '' }} with: java-version: ${{ inputs.LUCEE_TEST_JAVA_VERSION }} @@ -46,21 +47,26 @@ jobs: if: ${{ inputs.LUCEE_TEST_JAVA_VERSION != '' }} run: echo "LUCEE_TEST_JAVA_EXEC=${{ env.JAVA_HOME }}/bin/java" >> $GITHUB_ENV - name: Set up JDK 8 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: '8' distribution: 'temurin' + + - name: Disable DEPLOY if not building with Java 8 (Lucee default) + if: ${{ env.LUCEE_BUILD_JAVA_VERSION != '8' }} + run: echo "DO_DEPLOY=false" >> $GITHUB_ENV + - name: Cache Lucee extensions - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/work/Lucee/Lucee/cache/ key: lucee-extensions restore-keys: lucee-extensions - name: Cache Maven packages - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: | - ~/.m2/repository + ~/.m2/repository/* !~/.m2/repository/org/lucee/lucee/ key: ${{ runner.os }}-maven-${{ hashFiles('loader/pom.xml','core/pom.xml') }} restore-keys: | @@ -106,8 +112,10 @@ jobs: MSSQL_PORT: 1433 MSSQL_DATABASE: master S3_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_ID_TEST }} - S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY_TEST }} - DO_DEPLOY: ${{ github.event_name == 'push' }} + # s3 tests disabled due to LDEV-4474 + #S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY_TEST }} + S3_BUCKET_PREFIX: lucee-ldev-5- + # DO_DEPLOY: ${{ github.event_name == 'push' }} # for uploading successful builds S3_ACCESS_ID_DOWNLOAD: ${{ secrets.S3_ACCESS_ID_DOWNLOAD }} S3_SECRET_KEY_DOWNLOAD: ${{ secrets.S3_SECRET_KEY_DOWNLOAD }} @@ -118,15 +126,18 @@ jobs: LUCEE_DOCKER_FILES_PAT_TOKEN: ${{ secrets.LUCEE_DOCKER_FILES_PAT_TOKEN }} #run: ant -noinput -buildfile loader/build.xml run: | - if [ "${{ github.event_name == 'push' }}" == "true" ]; then + if [ "${{ env.DO_DEPLOY }}" == "true" ]; then echo "------- Maven Deploy on ${{ github.event_name }} -------"; mvn -B -e -f loader/pom.xml clean deploy --settings travis-settings.xml -DtestJavaVersionExec="${{ env.LUCEE_TEST_JAVA_EXEC }}"; else - echo "------- Maven Install on ${{ github.event_name }} ---------" + echo "------- Maven Install on ${{ github.event_name }} ---------"; mvn -B -e -f loader/pom.xml clean install -DtestJavaVersionExec="${{ env.LUCEE_TEST_JAVA_EXEC }}" fi + - name: Remove Lucee build artifacts from local maven cache (avoid growing cache) + run: | + rm -rfv ~/.m2/repository/org/lucee/lucee/ - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@v1 + uses: EnricoMi/publish-unit-test-result-action@v2 if: always() with: files: test/reports/junit-test-results.xml diff --git a/ant/build-core.xml b/ant/build-core.xml index f5af3d57cf..2ef228f047 100644 --- a/ant/build-core.xml +++ b/ant/build-core.xml @@ -946,6 +946,7 @@ + diff --git a/ant/upload-to-s3.xml b/ant/upload-to-s3.xml index dfff1f9eeb..abcde83001 100644 --- a/ant/upload-to-s3.xml +++ b/ant/upload-to-s3.xml @@ -2,14 +2,14 @@ - - - - - - - - + + + + + + + + @@ -17,198 +17,44 @@ diff --git a/ant/upload_to_s3.cfm b/ant/upload_to_s3.cfm new file mode 100644 index 0000000000..79dcc1883d --- /dev/null +++ b/ant/upload_to_s3.cfm @@ -0,0 +1,235 @@ + + // firstly, check are we even deploying to s3 + if ( (server.system.environment.DO_DEPLOY?:false) eq false ){ + SystemOutput( "skip, DO_DEPLOY is false", 1 ,1 ); + return; + } + // secondly, do we have the s3 extension? + s3ExtVersion = extensionList().filter( function(row){ return row.name contains "s3"; }).version; + if ( s3Extversion eq "" ){ + SystemOutput( "ERROR! The S3 Extension isn't installed!", true ); + return; + //throw "The S3 Extension isn't installed!"; // fatal + } else { + SystemOutput( "Using S3 Extension: #s3ExtVersion#", true ); + } + + // finally check for S3 credentials + if ( isNull( server.system.environment.S3_ACCESS_ID_DOWNLOAD ) + || isNull( server.system.environment.S3_SECRET_KEY_DOWNLOAD ) ) { + SystemOutput( "no S3 credentials defined to upload to S3", 1, 1 ); + return; + //throw "no S3 credentials defined to upload to S3"; + //trg.dir = ""; + } + + NL = " +"; + + src.jar = server.system.properties.luceejar; + src.core = server.system.properties.luceeCore; + src.dir = getDirectoryFromPath( src.jar ); + src.jarName = listLast( src.jar,"\/" ); + src.coreName = listLast( src.core,"\/" ); + src.version = mid( src.coreName,1,len( src.coreName )-4 ); + + if ( ! FileExists( src.jar ) || ! FileExists( src.core ) ){ + SystemOutput( src.jar & " exists: " & FileExists( src.jar ), true ); + SystemOutput( src.core & " exists: " & FileExists( src.core ), true ); + throw "missing jar or .lco file"; + } + + s3_bucket = "lucee-downloads"; + trg.dir = "s3://#server.system.environment.S3_ACCESS_ID_DOWNLOAD#:#server.system.environment.S3_SECRET_KEY_DOWNLOAD#@/#s3_bucket#/"; + + // test s3 access + SystemOutput( "Testing S3 Bucket Access", 1, 1 ); + if (! DirectoryExists( trg.dir ) ) + throw "DirectoryExists failed for s3 bucket [#s3_bucket#]"; // it usually will throw an error, rather than even reach this throw, if it fails + + trg.jar = trg.dir & src.jarName; + trg.core = trg.dir & src.coreName; + + // we only upload / publish artifacts once LDEV-3921 + + if ( fileExists( trg.jar ) && fileExists( trg.core ) ){ + SystemOutput( "Build artifacts have already been uploaded for this version, nothing to do", 1, 1 ); + return; + } + + function sendToS3 (name, path) { + var fh = fileOpen( path ); + s3write( bucketName=s3_bucket, + objectName=arguments.name, + value=fh, + accessKeyId=server.system.environment.S3_ACCESS_ID_DOWNLOAD, + secretAccessKey=server.system.environment.S3_SECRET_KEY_DOWNLOAD + ); + fileClose( fh ); + } + + // copy jar + SystemOutput( "upload #src.jarName# to S3",1,1 ); + if ( fileExists( trg.jar ) ){ + fileDelete( trg.jar ); + } + sendToS3( src.jarName, src.jar ); + + // copy core + SystemOutput( "upload #src.coreName# to S3",1,1 ); + if ( fileExists( trg.core ) ){ + fileDelete( trg.core ); + } + sendToS3( src.coreName, src.core ); + + // create war + src.warName = "lucee-" & src.version & ".war"; + src.war = src.dir & src.warName; + trg.war = trg.dir & src.warName; + + /* + SystemOutput( "upload #src.warName# to S3",1,1 ); + zip action = "zip" file = src.war overwrite = true { + + // loader + zipparam source = src.jar entrypath = "WEB-INF/lib/lucee.jar"; + + // common files + // zipparam source = commonDir; + + // website files + // zipparam source = webDir; + + // war files + // zipparam source = warDir; + } + fileCopy( src.war,trg.war ); + */ + + // Lucee light build (no extensions) + src.lightName = "lucee-light-" & src.version & ".jar"; + SystemOutput( "build and upload #src.lightName# to S3",1,1 ); + src.light = src.dir & src.lightName; + trg.light = trg.dir & src.lightName; + createLight( src.jar,src.light,src.version, false ); + + sendToS3( src.lightName, src.light ); + + // Lucee zero build, built from light but also no admin or docs (disabled, 6.0 only) + /* + src.zeroName = "lucee-zero-" & src.version & ".jar"; + SystemOutput( "build and upload #src.zeroName# to S3",1,1 ); + src.zero = src.dir & src.zeroName; + trg.zero = trg.dir & src.zeroName; + createLight( src.light, src.zero,src.version, true ); + fileCopy( src.zero, trg.zero ); + */ + // update provider + + systemOutput("Trigger builds", true); + http url="https://update.lucee.org/rest/update/provider/buildLatest" method="GET" timeout=90 result="buildLatest"; + systemOutput(buildLatest.fileContent, true); + + systemOutput("Update Extension Provider", true); + http url="https://extension.lucee.org/rest/extension/provider/reset" method="GET" timeout=90 result="extensionReset"; + systemOutput(extensionReset.fileContent, true); + + systemOutput("Update Downloads Page", true); + http url="https://download.lucee.org/?type=snapshots&reset=force" method="GET" timeout=90 result="downloadUpdate"; + systemOutput("Server response status code: " & downloadUpdate.statusCode, true); + + // forgebox + + systemOutput("Trigger forgebox builds", true); + + gha_pat_token = server.system.environment.LUCEE_DOCKER_FILES_PAT_TOKEN; // github person action token + body = { + "event_type": "forgebox_deploy" + }; + try { + http url="https://api.github.com/repos/Ortus-Lucee/forgebox-cfengine-publisher/dispatches" method="POST" result="result" timeout="90"{ + httpparam type="header" name='authorization' value='Bearer #gha_pat_token#'; + httpparam type="body" value='#body.toJson()#'; + + } + systemOutput("Forgebox build triggered, #result.statuscode# (always returns a 204 no content, see https://github.com/Ortus-Lucee/forgebox-cfengine-publisher/actions for output)", true); + } catch (e){ + systemOutput("Forgebox build ERRORED?", true); + echo(e); + } + + // Lucee Docker builds + + systemOutput("Trigger Lucee Docker builds", true); + + gha_pat_token = server.system.environment.LUCEE_DOCKER_FILES_PAT_TOKEN; // github person action token + body = { + "event_type": "build-docker-images", + "client_payload": { + "LUCEE_VERSION": server.system.properties.luceeVersion + } + }; + try { + http url="https://api.github.com/repos/lucee/lucee-dockerfiles/dispatches" method="POST" result="result" timeout="90"{ + httpparam type="header" name='authorization' value='Bearer #gha_pat_token#'; + httpparam type="body" value='#body.toJson()#'; + } + systemOutput("Lucee Docker builds triggered, #result.statuscode# (always returns a 204 no content, see https://github.com/lucee/lucee-dockerfiles/actions for output)", true); + } catch (e){ + systemOutput("Lucee Docker build ERRORED?", true); + echo(e); + } + + // express + + private function createLight( string loader, string trg, version, boolean noArchives=false ) { + var sep = server.separator.file; + var tmpDir = getTempDirectory(); + + local.tmpLoader = tmpDir & "lucee-loader-" & createUniqueId( ); // the jar + if ( directoryExists( tmpLoader ) ) + directoryDelete( tmpLoader,true ); + directoryCreate( tmpLoader ); + + // unzip + zip action = "unzip" file = loader destination = tmpLoader; + + // remove extensions + var extDir = tmpLoader&sep&"extensions"; + if ( directoryExists( extDir ) ) + directoryDelete( extDir, true ); // deletes directory with all files inside + directoryCreate( extDir ); // create empty dir again ( maybe Lucee expect this directory to exist ) + + // unzip core + var lcoFile = tmpLoader & sep & "core" & sep & "core.lco"; + local.tmpCore = tmpDir & "lucee-core-" & createUniqueId( ); // the jar + directoryCreate( tmpCore ); + zip action = "unzip" file = lcoFile destination = tmpCore; + + if (arguments.noArchives) { + // delete the lucee-admin.lar and lucee-docs.lar + var lightContext = tmpCore & sep & "resource/context" & sep; + loop list="lucee-admin.lar,lucee-doc.lar" item="local.larFile" { + fileDelete( lightContext & larFile ); + } + } + + // rewrite manifest + var manifest = tmpCore & sep & "META-INF" & sep & "MANIFEST.MF"; + var content = fileRead( manifest ); + var index = find( 'Require-Extension',content ); + if ( index > 0 ) + content = mid( content, 1, index - 1 ) & variables.NL; + fileWrite( manifest,content ); + + // zip core + fileDelete( lcoFile ); + zip action = "zip" source = tmpCore file = lcoFile; + + // zip loader + if ( fileExists( trg ) ) + fileDelete( trg ); + zip action = "zip" source = tmpLoader file = trg; + + } + \ No newline at end of file diff --git a/test/_setupTestServices.cfc b/test/_setupTestServices.cfc index 9af12edd1b..03a91bcfb1 100644 --- a/test/_setupTestServices.cfc +++ b/test/_setupTestServices.cfc @@ -238,14 +238,25 @@ component { } public function verifyS3 ( s3 ) localmode=true{ - bucketName = "lucee-testsuite"; + bucketName = arguments.s3.BUCKET_PREFIX & lcase(hash(CreateGUID())); base = "s3://#arguments.s3.ACCESS_KEY_ID#:#arguments.s3.SECRET_KEY#@/#bucketName#"; - DirectoryExists( base ); - return "s3 Connection Verified"; + directoryCreate( base ); + directoryDelete( base ); + return "s3 Connection Verified [#bucketName#]"; } public function addSupportFunctions() { + server._getTempDir = function ( string prefix="" ) localmode=true{ + if ( len( arguments.prefix ) eq 0 ) { + local.dir = getTempDirectory() & "lucee-tests\" & createGUID(); + } else { + local.dir = getTempDirectory() & "lucee-tests\" & arguments.prefix; + } + if ( !directoryExists( dir ) ) + directoryCreate( dir, true ); + return dir; + }; server._getSystemPropOrEnvVars = function ( string props="", string prefix="", boolean stripPrefix=true, boolean allowEmpty=false ) localmode=true{ st = [=]; keys = arguments.props.split( "," ); @@ -284,7 +295,11 @@ component { server.getDefaultBundleVersion = getDefaultBundleVersion; server.getBundleVersions = getBundleVersions; } - public struct function getTestService( required string service, string dbFile="", boolean verify=false ) localmode=true { + public struct function getTestService( required string service, + string dbFile="", + boolean verify=false, + boolean onlyConfig=false + ) localmode=true { if ( StructKeyExists( server.test_services, arguments.service ) ){ if ( !server.test_services[ arguments.service ].valid ){ //SystemOutput("Warning service: [ #arguments.service# ] is not available", true); @@ -298,6 +313,8 @@ component { case "mssql": mssql = server._getSystemPropOrEnvVars( "SERVER, USERNAME, PASSWORD, PORT, DATABASE", "MSSQL_"); if ( structCount( msSql ) gt 0){ + if ( arguments.onlyConfig ) + return msSql; return { class: 'com.microsoft.sqlserver.jdbc.SQLServerDriver' , bundleName: 'org.lucee.mssql' @@ -311,6 +328,8 @@ component { case "mysql": mysql = server._getSystemPropOrEnvVars( "SERVER, USERNAME, PASSWORD, PORT, DATABASE", "MYSQL_"); if ( structCount( mySql ) gt 0 ){ + if ( arguments.onlyConfig ) + return mySql; return { class: 'com.mysql.cj.jdbc.Driver' , bundleName: 'com.mysql.cj' @@ -324,6 +343,8 @@ component { case "postgres": pgsql = server._getSystemPropOrEnvVars( "SERVER, USERNAME, PASSWORD, PORT, DATABASE", "POSTGRES_"); if ( structCount( pgsql ) gt 0 ){ + if ( arguments.onlyConfig ) + return pgsql; return { class: 'org.postgresql.Driver' , bundleName: 'org.postgresql.jdbc' @@ -367,6 +388,8 @@ component { case "oracle": oracle = server._getSystemPropOrEnvVars( "SERVER, USERNAME, PASSWORD, PORT, DATABASE", "ORACLE_"); if ( structCount( oracle ) gt 0 ){ + if ( arguments.onlyConfig ) + return oracle; return { class: 'oracle.jdbc.OracleDriver' , bundleName: 'ojdbc6' @@ -408,7 +431,7 @@ component { } break; case "s3": - s3 = server._getSystemPropOrEnvVars( "ACCESS_KEY_ID, SECRET_KEY", "S3_" ); + s3 = server._getSystemPropOrEnvVars( "ACCESS_KEY_ID, SECRET_KEY, BUCKET_PREFIX", "S3_" ); return s3; default: break; diff --git a/test/extension/S3.cfc b/test/extension/S3.cfc index c8be09adab..c170d77a23 100644 --- a/test/extension/S3.cfc +++ b/test/extension/S3.cfc @@ -1,9 +1,9 @@ -component extends="org.lucee.cfml.test.LuceeTestCase" { +component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" skip=true { function beforeAll() skip="isNotSupported"{ if(isNotSupported()) return; var s3Details = getCredentials(); - id=lcase(hash(CreateGUID())); + id = s3Details.BUCKET_PREFIX & "s3ext-" & lcase(hash(CreateGUID())); root = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@/"; } @@ -15,7 +15,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { it(title="create/delete a empty bucket", skip=isNotSupported(), body=function( currentSpec ){ SystemOutput(root,1,1); - var bucketName = "test-create-bucket1-#id#"; + var bucketName = "#id#-1"; var bucketPath=root&bucketName; try { expect(directoryExists(bucketPath)).toBeFalse(); @@ -30,7 +30,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { }); it(title="create/delete a bucket with a file", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-create-bucket2-#id#"; + var bucketName = "#id#-2"; var bucketPath=root&bucketName; try { expect(directoryExists(bucketPath)).toBeFalse(); @@ -55,7 +55,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { }); it(title="create/delete a empty folder", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-create-folder1-#id#"; + var bucketName = "#id#-folder1"; var bucketPath=root&bucketName; var folderPath=bucketPath&"/folder1"; try { @@ -73,7 +73,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { }); it(title="create/delete a folder with a file", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-create-folder2-#id#"; + var bucketName = "#id#-folder2"; var bucketPath=root&bucketName; var folderPath=bucketPath&"/folder1"; try { @@ -100,7 +100,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { }); it(title="create/delete a file", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-create-file-#id#"; + var bucketName = "#id#-file"; var bucketPath=root&bucketName; var filePath=bucketPath&"/foo.txt"; try { @@ -119,7 +119,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { it(title="copy a empty bucket", skip=isNotSupported(), body=function( currentSpec ){ SystemOutput(root,1,1); - var bucketName = "test-copy-bucket1-#id#"; + var bucketName = "#id#-b1"; var bucketPathSrc=root&bucketName; var bucketPathTrg=bucketPathSrc&"copied"; try { @@ -151,7 +151,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { it(title="copy a bucket with content", skip=isNotSupported(), body=function( currentSpec ){ SystemOutput(root,1,1); - var bucketName = "test-copy-bucket2-#id#"; + var bucketName = "#id#-b2"; var bucketPathSrc=root&bucketName; var folderPathSrc=bucketPathSrc&"/folder1"; var filePathSrc=folderPathSrc&"/foo.txt"; @@ -193,7 +193,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { }); it(title="list buckets", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-list1-#id#"; + var bucketName = "#id#-list1"; var bucketPath=root&bucketName; try { directoryCreate(bucketPath); @@ -213,7 +213,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { }); it(title="list content of a bucket", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-list2-#id#"; + var bucketName = "#id#-list2"; var bucketPath=root&bucketName; var folderPath=bucketPath&"/folder1"; var filePath=folderPath&"/foo.txt"; @@ -230,10 +230,9 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { } }); - - it(title="move a bucket with content", skip=isNotSupported(), body=function( currentSpec ){ + xit(title="move a bucket with content", skip=isNotSupported(), body=function( currentSpec ){ SystemOutput(root,1,1); - var bucketName = "test-copy-move-#id#"; + var bucketName = "#id#-move"; var bucketPathSrc=root&bucketName; var folderPathSrc=bucketPathSrc&"/folder1"; var filePathSrc=folderPathSrc&"/foo.txt"; @@ -271,7 +270,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { }); it(title="file append/write", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-append-#id#"; + var bucketName = "#id#-append"; var bucketPath=root&bucketName; var filePath=bucketPath&"/foo.txt"; try { @@ -295,7 +294,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { it(title="file copy/delete", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-append-#id#"; + var bucketName = "#id#-append2"; var bucketPathSrc=root&bucketName&"src"; var bucketPathTrg=root&bucketName&"trg"; var filePathSrc=bucketPathSrc&"/foosrc.txt"; @@ -336,7 +335,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { it(title="file move/delete", skip=isNotSupported(), body=function( currentSpec ){ - var bucketName = "test-append-#id#"; + var bucketName = "#id#-append-3"; var bucketPathSrc=root&bucketName&"src"; var bucketPathTrg=root&bucketName&"trg"; var filePathSrc=bucketPathSrc&"/foosrc.txt"; @@ -377,7 +376,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { it(title="check having a file and directory with the same name", skip=true, body=function( currentSpec ) { if(isNotSupported()) return; - var bucketName = "test-same-#id#"; + var bucketName = "#id#-same"; var base = root & bucketName; if( directoryExists(base)) @@ -420,6 +419,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { public boolean function isNotSupported() { + return true; return structCount(getCredentials())==0; } diff --git a/test/general/Resources.cfc b/test/general/Resources.cfc index 510f642584..8ce0b97e72 100755 --- a/test/general/Resources.cfc +++ b/test/general/Resources.cfc @@ -482,7 +482,7 @@ private function assertEqualPaths(string path1, string path2) { private void function test(string label,string root){ var start=getTickCount(); - var dir=arguments.root&"lucee-res-#lcase(hash(CreateGUID()))#/"; + var dir=arguments.root&"lucee-ldev-#lcase(hash(CreateGUID()))#/"; // make sure there are no data from a previous run if(directoryExists(dir)) { @@ -575,7 +575,7 @@ private function assertEqualPaths(string path1, string path2) { return server.getTestService("s3"); } - public void function testS3() localmode=true{ + public void function testS3() localmode=true skip=true{ var s3 = getCredentials(); if( !isNull( s3.ACCESS_KEY_ID ) ) { application action="update" s3={ @@ -586,7 +586,7 @@ private function assertEqualPaths(string path1, string path2) { } } - public void function testS3AsMapping() localmode=true{ + public void function testS3AsMapping() localmode=true skip=true { var s3 = getCredentials(); if( !isNull( s3.ACCESS_KEY_ID ) ) { application action="update" s3={ diff --git a/test/tags/Http.cfc b/test/tags/Http.cfc index 894463b16e..87db01533d 100644 --- a/test/tags/Http.cfc +++ b/test/tags/Http.cfc @@ -42,7 +42,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { } } - public void function testImplicit(){ + public void function testImplicit() skip=true { var data=chr(228)&chr(246)&chr(252); // äöü data="{aaa:'#data#'}"; http url="https://update.lucee.org/rest/update/provider/echoPut" result="local.res" method="put" throwonerror="no" charset="utf-8"{ @@ -52,7 +52,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" { assertEquals(data,res.httpRequestData.content); } - public void function testExplicit(){ + public void function testExplicit() skip=true { var data=chr(228)&chr(246)&chr(252); // äöü data="{aaa:'#data#'}"; http url="https://update.lucee.org/rest/update/provider/echoPut" result="local.res" method="put" throwonerror="no" charset="utf-8"{ diff --git a/test/tickets/LDEV0359.cfc b/test/tickets/LDEV0359.cfc index 1fb4acd0c3..fafba50f9d 100644 --- a/test/tickets/LDEV0359.cfc +++ b/test/tickets/LDEV0359.cfc @@ -1,6 +1,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase"{ // skip closure function isNotSupported() { + return true; variables.s3Details=getCredentials(); return structIsEmpty(s3Details); } @@ -8,7 +9,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase"{ function beforeAll() skip="isNotSupported"{ if(isNotSupported()) return; s3Details = getCredentials(); - mitrahsoftBucketName = "lucee-ldev0359-#lcase(hash(CreateGUID()))#"; + mitrahsoftBucketName = lcase( s3Details.bucket_prefix & "0359-#hash( CreateGUID() )#"); base = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@"; baseWithBucketName = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@/#mitrahsoftBucketName#"; // for skipping rest of the cases, if error occurred. diff --git a/test/tickets/LDEV0931.cfc b/test/tickets/LDEV0931.cfc index c9e6dccbf5..2c3b2bc756 100644 --- a/test/tickets/LDEV0931.cfc +++ b/test/tickets/LDEV0931.cfc @@ -16,7 +16,7 @@ * License along with this library. If not, see . * ---> -component extends="org.lucee.cfml.test.LuceeTestCase" { +component extends="org.lucee.cfml.test.LuceeTestCase" skip=true { public void function testImplicit(){ var data=chr(228)&chr(246)&chr(252); // äöü diff --git a/test/tickets/LDEV1116.cfc b/test/tickets/LDEV1116.cfc index fe241d3eaa..9e916901d4 100644 --- a/test/tickets/LDEV1116.cfc +++ b/test/tickets/LDEV1116.cfc @@ -24,6 +24,6 @@ component extends="org.lucee.cfml.test.LuceeTestCase"{ } private struct function getCredentials() { - return server.getDatasource("oracle"); + return server.getDatasource(service="oracle", onlyConfig=true); } } diff --git a/test/tickets/LDEV1129.cfc b/test/tickets/LDEV1129.cfc index 88038ce38d..4f264cdb34 100644 --- a/test/tickets/LDEV1129.cfc +++ b/test/tickets/LDEV1129.cfc @@ -2,20 +2,23 @@ // skip closure function isNotSupported() { + return true; variables.s3Details=getCredentials(); return structIsEmpty(s3Details); } function beforeAll() skip="isNotSupported"{ - variables.bucketName = lcase("lucee-ldev1129-#CreateGUID()#"); + if ( isNotSupported() ) return; + + var s3Details = getCredentials(); + variables.bucketName = lcase( s3Details.bucket_prefix & "1129-#CreateGUID()#"); var uri = createURI( variables.bucketName ); + if (not directoryExists(uri) ){ Directorycreate(uri); Directorycreate("#uri#/test"); Directorycreate("#uri#/test2"); } - if ( isNotSupported() ) return; - var s3Details = getCredentials(); variables.base = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@"; variables.baseWithBucketName = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@/#bucketName#"; @@ -26,11 +29,14 @@ } function afterAll() skip="isNotSupported"{ - if (isNotSupported()) return; - if (directoryExists(baseWithBucketName) ) + if (!isNull(baseWithBucketName) && directoryExists(baseWithBucketName) ) directoryDelete(baseWithBucketName, true); + if (!isNull(testFolder) && directoryExists(testFolder) ) + directoryDelete(testFolder, true); + if (isNotSupported()) return; } + public function run( testResults , testBox ) { describe( title="Test suite for LDEV-1129 ( checking s3 file operations )", body=function() { aroundEach( function( spec, suite ){ diff --git a/test/tickets/LDEV1176.cfc b/test/tickets/LDEV1176.cfc index 01a0574f61..f17a11c8a1 100644 --- a/test/tickets/LDEV1176.cfc +++ b/test/tickets/LDEV1176.cfc @@ -1,6 +1,7 @@ -component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3"{ +component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" skip=true { // skip closure function isNotSupported() { + return true; variables.s3Details=getCredentials(); if (structIsEmpty(s3Details)) return true; if (!isNull(variables.s3Details.ACCESS_KEY_ID) && !isNull(variables.s3Details.SECRET_KEY)) { @@ -36,7 +37,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3"{ } public function run( testResults , testBox ) { - describe( title="Test suite for LDEV-1176 ( checking directoryExists() with large s3 bucket )", body=function() { + describe( title="Test suite for LDEV-1176 ( checking directoryExists() with large s3 bucket )", skip=true, body=function() { aroundEach( function( spec, suite ){ if(!hasError) arguments.spec.body(); diff --git a/test/tickets/LDEV1396.cfc b/test/tickets/LDEV1396.cfc index d6c0348074..38503384de 100644 --- a/test/tickets/LDEV1396.cfc +++ b/test/tickets/LDEV1396.cfc @@ -1,21 +1,18 @@ - + // skip closure function isNotSupported() { + return true; variables.s3Details=getCredentials(); return structIsEmpty(s3Details); } function beforeAll() skip="isNotSupported"{ if(isNotSupported()) return; - s3Details = getCredentials(); - mitrahsoftBucketName = "lucee-ldev1396-#lcase(hash(CreateGUID()))#"; - base = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@"; + var s3Details = getCredentials(); + var mitrahsoftBucketName = lcase( s3Details.bucket_prefix & "1396-#lcase(hash(CreateGUID()))#" ); + var base = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@"; variables.baseWithBucketName = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@/#mitrahsoftBucketName#"; - // for skipping rest of the cases, if error occurred. - hasError = false; - // for replacing s3 access keys from error msgs - regEx = "\[[a-zA-Z0-9\:\/\@]+\]"; } function afterAll() skip="isNotSupported"{ @@ -51,7 +48,7 @@ } private function removeFullControl(acl) { - index=0; + var index=0; loop array=acl index="local.i" item="local.el" { if(el.permission=="FULL_CONTROL") local.index=i; diff --git a/test/tickets/LDEV1489.cfc b/test/tickets/LDEV1489.cfc index 210795746d..039f3f6473 100644 --- a/test/tickets/LDEV1489.cfc +++ b/test/tickets/LDEV1489.cfc @@ -1,17 +1,24 @@ - + // skip closure function isNotSupported() { + return true; variables.s3Details=getCredentials(); - return structIsEmpty(s3Details); + if(structIsEmpty(s3Details)) return true; + if(!isNull(variables.s3Details.ACCESS_KEY_ID) && !isNull(variables.s3Details.SECRET_KEY)) { + variables.supported = true; + } + else + variables.supported = false; + return !variables.supported; } function beforeAll() skip="isNotSupported"{ if(isNotSupported()) return; s3Details = getCredentials(); - mitrahsoftBucketName = lcase("lucee-ldev1489-#lcase(hash(CreateGUID()))#"); + bucketName = lcase( s3Details.bucket_prefix & "1489-#hash(CreateGUID())#"); base = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@"; - variables.baseWithBucketName = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@/#mitrahsoftBucketName#"; + variables.baseWithBucketName = "s3://#s3Details.ACCESS_KEY_ID#:#s3Details.SECRET_KEY#@/#bucketName#"; // for skipping rest of the cases, if error occurred. hasError = false; // for replacing s3 access keys from error msgs @@ -38,7 +45,7 @@ local.result = _InternalRequest( template:"#uri#/test.cfm", url: { - bucketName: mitrahsoftBucketName + bucketName: bucketName } ); expect(listSort(local.result.filecontent,"textnocase","asc","|")).toBe('READ|WRITE'); @@ -78,7 +85,9 @@ cffile (action="write", file=baseWithBucketName & "/test6.txt", output="Sample s3 text"); var acl = StoreGetACL( baseWithBucketName & "/test6.txt" ); removeFullControl(acl); - expect(acl[1].permission).toBe('READ'); + + if(isNewS3())expect(len(acl)).toBe(0); + else expect(acl[1].permission).toBe('READ'); }); @@ -91,7 +100,7 @@ if(el.permission=="FULL_CONTROL") local.index=i; } - if(index>0)ArrayDeleteAt( acl, index ); + if(index gt 0) ArrayDeleteAt( acl, index ); } // Private functions @@ -104,6 +113,16 @@ var baseURI="/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/"; return baseURI&""&calledName; } + + private function isNewS3(){ + qry= extensionlist(false); + loop query=qry { + if(qry.id=="17AB52DE-B300-A94B-E058BD978511E39E") { + if(left(qry.version,1)>=2) return true; + } + } + return false; + }