adjust tests
This commit is contained in:
+15
-18
@@ -4,33 +4,30 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test-setup-trivy:
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [ amd64, arm64 ]
|
||||
name: Test Setup Trivy ${{ matrix.arch }}
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
- linux_${{ matrix.arch }}
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Trivy
|
||||
uses: ./setup-trivy
|
||||
- name: Run Trivy
|
||||
run: trivy --version
|
||||
|
||||
test-setup-db:
|
||||
name: Test Setup DB
|
||||
runs-on:
|
||||
- ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- uses: ./setup-trivy
|
||||
- name: Setup DB
|
||||
id: setup-db
|
||||
uses: ./setup-db
|
||||
- name: Run Trivy
|
||||
run: trivy fs --skip-db-update --cache-dir ${{ steps.setup-db.outputs.cache-dir }} .
|
||||
- name: Verify vulnerability DB in cache
|
||||
run: |
|
||||
set -euo pipefail
|
||||
cache="${{ steps.setup-db.outputs.cache-dir }}"
|
||||
db="$cache/db/trivy.db"
|
||||
meta="$cache/db/metadata.json"
|
||||
test -f "$meta" || { echo "FAIL: $meta missing (DB not downloaded?)"; exit 1; }
|
||||
test -f "$db" || { echo "FAIL: $db missing (DB not downloaded?)"; exit 1; }
|
||||
size=$(stat -c%s "$db")
|
||||
min=$((3 * 1024 * 1024))
|
||||
if [ "$size" -lt "$min" ]; then
|
||||
echo "FAIL: trivy.db too small ($size bytes; expected at least $min bytes, i.e. a few MiB)"
|
||||
exit 1
|
||||
fi
|
||||
echo "OK: trivy.db is present ($size bytes) and metadata.json exists."
|
||||
|
||||
test-get-images-from-files:
|
||||
name: Test Get Images From Files
|
||||
|
||||
Reference in New Issue
Block a user