test: make test cases unique and test de-duplication
This commit is contained in:
@@ -49,13 +49,16 @@ jobs:
|
||||
run: |
|
||||
images="${{ steps.giff.outputs.images }}"
|
||||
echo "Extracted: $images"
|
||||
# Registry with tag
|
||||
echo "$images" | grep -q 'example.com/library/nginx:latest'
|
||||
echo "$images" | grep -q 'example.com/library/redis:7-alpine'
|
||||
echo "$images" | grep -q 'example.com/library/app:1.25-alpine'
|
||||
# Registry path with tag
|
||||
# Dockerfile-only: registry with tag, registry with digest
|
||||
echo "$images" | grep -q 'example.com/library/nginx:v1'
|
||||
echo "$images" | grep -q 'example.com/library/base@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
# K8s-only: registry with tag, registry with digest
|
||||
echo "$images" | grep -q 'example.com/library/app:v2'
|
||||
echo "$images" | grep -q 'example.com/myproject/helper@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'
|
||||
# Shared ref (in both Dockerfile and K8s) — must appear exactly once
|
||||
echo "$images" | grep -q 'example.com/distroless/static:nonroot'
|
||||
# Registry with digest
|
||||
echo "$images" | grep -q 'example.com/distroless/static@sha256:abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd'
|
||||
echo "$images" | grep -q 'example.com/library/alpine@sha256:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
|
||||
echo "$images" | grep -q 'example.com/myproject/myimg@sha256:abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcd'
|
||||
count=$(echo "$images" | tr ',' '\n' | grep -c 'example.com/distroless/static:nonroot' || true)
|
||||
[ "$count" -eq 1 ] || { echo "expected shared ref once, got: $count"; exit 1; }
|
||||
# Total unique refs: 5
|
||||
total=$(echo "$images" | tr ',' '\n' | grep -c . || true)
|
||||
[ "$total" -eq 5 ] || { echo "expected 5 unique refs, got: $total"; exit 1; }
|
||||
|
||||
Reference in New Issue
Block a user