mirror of
https://github.com/SonarSource/sonarqube-scan-action.git
synced 2025-12-16 02:56:30 +00:00
SQSCANGHA-92 Fixing tests round 1
This commit is contained in:
parent
201c59b352
commit
3fcca80d1e
2 changed files with 32 additions and 3 deletions
34
.github/workflows/qa-main.yml
vendored
34
.github/workflows/qa-main.yml
vendored
|
|
@ -21,9 +21,11 @@ jobs:
|
||||||
env:
|
env:
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
SONAR_SCANNER_JSON_PARAMS: '{"sonar.scanner.internal.dumpToFile": "./output.properties"}'
|
SONAR_SCANNER_JSON_PARAMS: '{"sonar.scanner.internal.dumpToFile": "./output.properties"}'
|
||||||
- name: Assert
|
- name: Assert failure of previous step
|
||||||
|
if: steps.invalid_version.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
./test/assertFileContains ./output.properties "sonar.projectBaseDir=."
|
echo "Action with invalid scannerVersion should have failed but succeeded"
|
||||||
|
exit 1
|
||||||
argsInputTest:
|
argsInputTest:
|
||||||
name: >
|
name: >
|
||||||
'args' input
|
'args' input
|
||||||
|
|
@ -39,6 +41,7 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
args: -Dsonar.someArg=aValue -Dsonar.anotherArgWithSpaces="Another Value"
|
args: -Dsonar.someArg=aValue -Dsonar.anotherArgWithSpaces="Another Value"
|
||||||
|
scannerVersion: 6.1.0.4477
|
||||||
env:
|
env:
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
SONAR_SCANNER_JSON_PARAMS: '{"sonar.scanner.internal.dumpToFile": "./output.properties"}'
|
SONAR_SCANNER_JSON_PARAMS: '{"sonar.scanner.internal.dumpToFile": "./output.properties"}'
|
||||||
|
|
@ -61,6 +64,7 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
|
scannerVersion: 6.1.0.4477
|
||||||
args: -Dsonar.someArg=aValue && echo "Injection"
|
args: -Dsonar.someArg=aValue && echo "Injection"
|
||||||
env:
|
env:
|
||||||
SONAR_HOST_URL: http://not_actually_used
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
|
|
@ -86,6 +90,7 @@ jobs:
|
||||||
- name: Run action with projectBaseDir
|
- name: Run action with projectBaseDir
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
|
scannerVersion: 6.1.0.4477
|
||||||
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
projectBaseDir: ./baseDir
|
projectBaseDir: ./baseDir
|
||||||
env:
|
env:
|
||||||
|
|
@ -808,4 +813,27 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
[ -f "$SONAR_SSL_FOLDER/truststore.p12" ] || exit 1
|
[ -f "$SONAR_SSL_FOLDER/truststore.p12" ] || exit 1
|
||||||
TRUSTSTORE_P12_MOD_TIME_T3=$(stat -c %Y "$SONAR_SSL_FOLDER/truststore.p12")
|
TRUSTSTORE_P12_MOD_TIME_T3=$(stat -c %Y "$SONAR_SSL_FOLDER/truststore.p12")
|
||||||
[ "$TRUSTSTORE_P12_MOD_TIME_T2" != "$TRUSTSTORE_P12_MOD_TIME_T3" ] || exit 1
|
[ "$TRUSTSTORE_P12_MOD_TIME_T2" != "$TRUSTSTORE_P12_MOD_TIME_T3" ] || exit 1
|
||||||
|
scannerVersionValidationTest:
|
||||||
|
name: >
|
||||||
|
'scannerVersion' input validation
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Run action with invalid scannerVersion
|
||||||
|
id: invalid_version
|
||||||
|
uses: ./
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
scannerVersion: "7.1.0-SNAPSHOT"
|
||||||
|
args: -Dsonar.scanner.internal.dumpToFile=./output.properties
|
||||||
|
env:
|
||||||
|
NO_CACHE: true
|
||||||
|
SONAR_HOST_URL: http://not_actually_used
|
||||||
|
- name: Assert failure of previous step
|
||||||
|
if: steps.invalid_version.outcome == 'success'
|
||||||
|
run: |
|
||||||
|
echo "Action with invalid scannerVersion should have failed but succeeded"
|
||||||
|
exit 1
|
||||||
|
|
@ -30,6 +30,7 @@ runs:
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
INPUT_PROJECTBASEDIR: ${{ inputs.projectBaseDir }}
|
INPUT_PROJECTBASEDIR: ${{ inputs.projectBaseDir }}
|
||||||
|
INPUT_SCANNERVERSION: ${{ inputs.scannerVersion }}
|
||||||
- name: Load Sonar Scanner CLI from cache
|
- name: Load Sonar Scanner CLI from cache
|
||||||
id: sonar-scanner-cli
|
id: sonar-scanner-cli
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue