Skip to content

fix: tighten audit log count assertion in integration test - #89

Merged
Senthil455 merged 1 commit into
Senthil455:mainfrom
DivyashreeR008:fix/integration-test-audit-assertion
Jun 17, 2026
Merged

fix: tighten audit log count assertion in integration test#89
Senthil455 merged 1 commit into
Senthil455:mainfrom
DivyashreeR008:fix/integration-test-audit-assertion

Conversation

@DivyashreeR008

Copy link
Copy Markdown
Collaborator

Summary

Fixes #51 -- The audit log count assertion used -ge 0, which can never fail because every non-negative integer (including 0) satisfies it. Combined with 2>/dev/null, even a completely empty or failed response would silently pass.

Root Cause

Line 402 in run-integration-tests.sh:

if [ "$AUDIT_COUNT" -ge 0 ] 2>/dev/null; then

Three problems:

  1. -ge 0 is always true for any non-negative integer (0, 1, 42, etc.)
  2. 2>/dev/null hides bash errors if $AUDIT_COUNT is empty or not a number
  3. On parse failure, AUDIT_COUNT defaults to "0", which still satisfies -ge 0

The assertion was mathematically incapable of failing.

Changes

Before After
-ge 0 -gt 0 (requires at least 1 entry)
2>/dev/null suppressed errors Removed to surface parse failures
report_fail (soft failure, test continues) exit 1 (hard failure, stops the suite)
Generic pass/fail message Clear message showing actual count

The integration test suite will now correctly fail if the audit service stops recording logs, preventing silent audit compliance gaps.

The audit log count check used -ge 0, which passes for any
non-negative integer including 0. Combined with 2>/dev/null, this
assertion could never fail, even if the audit service returned
an empty response.

Changes:
- Replace -ge 0 with -gt 0 to require at least one audit entry
- Remove 2>/dev/null to surface potential parsing errors
- Exit immediately with code 1 on failure so broken audit logging
  is not silently ignored

Fixes Senthil455#51
@DivyashreeR008

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Confirmed the CI failures (notification-go-service, auth-service docker builds) are pre-existing and unrelated to this change -- this PR only touches the shell assertion logic in
un-integration-tests.sh.

@Senthil455
Senthil455 merged commit 5f6561b into Senthil455:main Jun 17, 2026
6 of 19 checks passed

@Senthil455 Senthil455 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gh: Not Found (HTTP 404)
{"message":"Not Found","documentation_url":"https://docs.github.com/rest/issues/comments#get-an-issue-comment","status":"404"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HIGH: Integration test audit count assertion passes with any non-negative integer

2 participants