Skip to content

Added a structured request-logging smoke test through app startup #572#633

Open
Rakshak05 wants to merge 4 commits into
utksh1:mainfrom
Rakshak05:backend-request-logging-smoke-test-572
Open

Added a structured request-logging smoke test through app startup #572#633
Rakshak05 wants to merge 4 commits into
utksh1:mainfrom
Rakshak05:backend-request-logging-smoke-test-572

Conversation

@Rakshak05
Copy link
Copy Markdown
Contributor

Closes #572

Description

This PR introduces a top-level integration/smoke test to ensure that request IDs and structured JSON logging are correctly integrated and function end-to-end through application startup.

Specifically, the following changes were made:

  • Added a logger.info("Health check endpoint accessed") call inside the /api/v1/health endpoint in main.py to ensure request-level logs are emitted during the request cycle.
  • Created testing/backend/integration/test_request_logging_smoke.py containing:
    • An integration test (test_request_id_appears_in_json_logs) checking that a generated request ID matches the one returned in response headers and is successfully correlated in the output JSON logs.
    • A passthrough test (test_passthrough_request_id) verifying that pre-existing request IDs sent in headers are propagated and correctly logged.
    • An in-memory logging capture fixture (log_capture) using the real application's RequestIDFilter and JSONFormatter.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

The smoke test was run and verified locally:

python -m pytest testing/backend/integration/test_request_logging_smoke.py

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.

[BACKEND] Add a structured request-logging smoke test through app startup

1 participant