Test presence of database instead of results of analysis

This is for PR #607, 'source-root' input test case.
This commit is contained in:
Mario Campos 2021-07-02 08:07:06 -05:00
parent 2c0da4bcc7
commit b9217ca238

View file

@ -905,21 +905,11 @@ jobs:
with: with:
languages: javascript languages: javascript
source-root: tests/multi-language-repo source-root: tests/multi-language-repo
- uses: ./analyze - name: Assert database exists
with:
output: "${{ runner.temp }}/results"
env:
TEST_MODE: true
- name: Assert Results
run: | run: |
cd "$RUNNER_TEMP/results" cd "$RUNNER_TEMP/codeql_databases"
# We should have 3 hits from these rules if [[ ! -d javascript ]]; then
EXPECTED_RULES="javascript/example/empty-or-one-block javascript/example/empty-or-one-block javascript/example/two-block" echo "Did not find a JavaScript database"
# use tr to replace newlines with spaces and xargs to trim leading and trailing whitespace
RULES="$(cat javascript.sarif | jq -r '.runs[0].results[].ruleId' | sort | tr "\n" " " | xargs)"
echo "Found matching rules '$RULES'"
if [ "$RULES" != "$EXPECTED_RULES" ]; then
echo "Did not match expected rules '$EXPECTED_RULES'."
exit 1 exit 1
fi fi