Skip to content

Commit

Permalink
Start rewriting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
henryju committed May 13, 2024
1 parent 3d0d4a9 commit a73f71f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
29 changes: 24 additions & 5 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ name: QA
on: [push, pull_request]

jobs:
integrationTest1:
name: Test 'args' input
argsInputTest:
name: >
'args' input
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -26,8 +27,9 @@ jobs:
echo "Property sonar.someArg=aValue not found in ./output.properties"
exit 1
fi
integrationTest2:
name: Test 'projectBaseDir' input
projectBaseDirInputTest:
name: >
'projectBaseDir' input
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -50,4 +52,21 @@ jobs:
if ! grep -q "sonar.projectBaseDir=.*/baseDir" ./output.properties; then
echo "Property sonar.projectBaseDir=.*/baseDir not found in ./output.properties"
exit 1
fi
fi
sonarHostUrlRequiredTest:
name: >
'SONAR_HOST_URL' is required
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run action without SONAR_HOST_URL
id: runTest
uses: ./
continue-on-error: true
- name: Previous should have failed
if: ${{ steps.runTest.outcome == 'success'}}
run: |
echo "Expected previous step to fail"
exit 1
8 changes: 0 additions & 8 deletions test/run-qa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,6 @@ if [[ $? -eq 0 ]]; then
fi
success "Correctly failed fast."

info "Test fail-fast if SONAR_HOST_URL is omitted..."
docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env SONAR_TOKEN=$token sonarsource/sonarqube-scan-action
if [[ $? -eq 0 ]]; then
error "Should have failed fast."
exit 1
fi
success "Correctly failed fast."

info "Test fail-fast on Gradle project..."
pushd test/gradle-project/
docker run -v `pwd`:/github/workspace/ --workdir /github/workspace --network $network --env SONAR_TOKEN=$token --env SONAR_HOST_URL='http://sonarqube:9000' sonarsource/sonarqube-scan-action
Expand Down

0 comments on commit a73f71f

Please sign in to comment.