Skip to content

Commit 38d8964

Browse files
test: fail_on_warn non-fail case reflects expiring-soon status
Review feedback on PR #11: the prior "does not fail" test used a plain valid cert, so the summary showed "Valid" rather than the nearing-expiry status the scenario is meant to demonstrate. Use an expiring cert that shares a subject with a newer valid replacement. With fail_on_warn=true this must not fail (WARN_COUNT stays 0), and the summary now correctly shows "Expiring Soon (newer replacement exists)". Adds the multi_expiring.pem fixture for this case. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent fc62dad commit 38d8964

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/test.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ jobs:
120120
-out "$FIXTURES_DIR/multi_valid.pem" -days 365 -nodes \
121121
-subj "/CN=multi.example.com" 2>/dev/null
122122
123+
# Expiring-soon cert sharing a subject with multi_valid.pem, used to
124+
# prove fail_on_warn does not fail when a newer valid replacement exists.
125+
openssl req -x509 -newkey rsa:2048 -keyout /dev/null \
126+
-out "$FIXTURES_DIR/multi_expiring.pem" -days 10 -nodes \
127+
-subj "/CN=multi.example.com" 2>/dev/null
128+
123129
echo "Fixtures generated:"
124130
ls -la "$FIXTURES_DIR"/*.pem
125131
@@ -221,16 +227,18 @@ jobs:
221227
grep -q "Expiring Soon" "$SUMMARY"
222228
rm -f "$SUMMARY"
223229
224-
- name: 'Test: fail_on_warn does not fail valid certificate'
230+
- name: 'Test: fail_on_warn does not fail when expiring cert has valid replacement'
225231
shell: bash
226232
run: |
227233
SUMMARY=$(mktemp)
228-
INPUT_CERTIFICATES='["tests/fixtures/valid.pem"]' \
234+
INPUT_CERTIFICATES='["tests/fixtures/multi_expiring.pem", "tests/fixtures/multi_valid.pem"]' \
229235
INPUT_WARNING_DAYS=30 \
230236
INPUT_FAIL_ON_WARN=true \
231237
GITHUB_STEP_SUMMARY="$SUMMARY" \
232238
bash validate.sh
233-
grep -q "✅ Valid" "$SUMMARY"
239+
# Must NOT fail (newer valid replacement exists, so WARN_COUNT stays 0),
240+
# and the summary status must reflect the nearing-expiry cert.
241+
grep -q "Expiring Soon (newer replacement exists)" "$SUMMARY"
234242
rm -f "$SUMMARY"
235243
236244
- name: 'Test: invalid JSON input'

0 commit comments

Comments
 (0)