Skip to content

Commit

Permalink
add test for deploy cfconfig to set empty value to empty
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jul 23, 2024
1 parent 61ccc06 commit 12e2e84
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
17 changes: 16 additions & 1 deletion .github/workflows/bad-cfconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ jobs:
env:
check_extensions: B737ABC4-D43F-4D91-8E8E973E37C40D1B:2.0.0.28-SNAPSHOT


- name: Copy .CFConfig-newer-extension.json5 into /deploy
if: always()
run: |
Expand All @@ -115,6 +114,22 @@ jobs:
check_extensions: B737ABC4-D43F-4D91-8E8E973E37C40D1B:2.0.0.28-SNAPSHOT
check_extensions_since: 6.1.1

- name: Copy .CFConfig-empty-cacheHandlers.json5 into /deploy
if: always()
run: |
mkdir -p /home/runner/work/_actions/lucee/script-runner/main/temp/lucee/lucee-server/deploy/
cp -a ${{ github.workspace }}/custom/bad-cfconfig/.CFConfig-empty-cacheHandlers.json5 /home/runner/work/_actions/lucee/script-runner/main/temp/lucee/lucee-server/deploy/.CFConfig.json
- name: Check good .CFConfig with newer image extension ( via /deploy )
uses: lucee/script-runner@main
if: always()
with:
webroot: ${{ github.workspace }}/custom/bad-cfconfig
execute: /debug.cfm
luceeVersionQuery: ${{ matrix.luceeVersion }}
preCleanup: false
env:
expect_empty_config: cacheHandlers

- name: Check bad .CFConfig with unknown extension version LUCEE_BASE_CONFIG
uses: lucee/script-runner@main
if: always()
Expand Down
3 changes: 3 additions & 0 deletions custom/bad-cfconfig/.CFConfig-empty-cacheHandlers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"cacheHandlers": {}
}
22 changes: 22 additions & 0 deletions custom/bad-cfconfig/debug.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
check_extensions = server.system.environment.check_extensions ?: "";
check_extensions_since = server.system.environment.check_extensions_since ?: "";
expect_empty_config = server.system.environment.expect_empty_config ?: "";\
// don't crash on older versions
if ( len( check_extensions_since ) ) {
Expand Down Expand Up @@ -149,6 +150,27 @@
}
}
}
if ( len( expect_empty_config ) ) {
_logger( "" );
_logger( "expect_empty_config: #expect_empty_config#" )
expect_empty_config = ListToArray( expect_empty_config, "," );
cfconfig = deserializeJSON( fileRead( expandPath('{lucee-config}.CFConfig.json') ) );
loop array=expect_empty_config item="prop"{
if ( !structKeyExists( cfconfig, "prop" ) ){
_logger( "ERROR: cfconfig property doesn't exist [#prop#]", true);
} else if ( isSimpleValue (config[prop ] ) ) {
_logger( "ERROR: cfconfig property [#prop#] should be an array or struct, [#cfconfig[ prop ].toJson()#]", true);
} else if ( len( cfconfig[ prop] ) != 0 ){
_logger( "ERROR: cfconfig property [#prop#] should be empty [#cfconfig[ prop ].toJson()# ]", true);
}
}
}
if ( structKeyExists( logs, "err.log" ) && len( logs["err.log"] ?: "" ) ) {
_logger( logs[ "err.log" ] , true);
Expand Down

0 comments on commit 12e2e84

Please sign in to comment.