Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Helicone Helicone Health Check Tests

From Leeroopedia
Knowledge Sources
Domains Local Development, Testing
Last Updated 2026-02-14 00:00 GMT

Overview

Concrete tool for verifying all Helicone services are running correctly after local setup, provided by the e2e/tests/on-push/ci-infra/health.test.ts Jest test suite and direct HTTP health check endpoints.

Description

The health check test suite (health.test.ts, 134 lines) uses axios to send HTTP requests to each service's health endpoint with retry logic. It verifies:

  • AI Gateway (port 8793): GET /healthcheck returns HTTP 200.
  • Worker API (port 8788): GET /healthcheck returns HTTP 200.
  • Jawn API (port 8585): GET /healthcheck returns HTTP 200 with a JSON body that has a status property.
  • ClickHouse (port 18123): GET /ping returns HTTP 200 with body Ok.\n.
  • PostgreSQL: Verified indirectly through Jawn's health check, which requires database connectivity to respond successfully.

An aggregate "All Services" test runs all checks in parallel via Promise.allSettled and logs a summary table showing each service's health status.

Service URLs are configured via e2e/lib/constants.ts (35 lines) which reads from environment variables with localhost defaults.

Usage

Use as the final verification step after all services are started. Can be run manually via curl or programmatically via the Jest test suite.

Code Reference

Source Location

  • Repository: Helicone
  • File: e2e/tests/on-push/ci-infra/health.test.ts (lines 47-133), e2e/lib/constants.ts (lines 1-35)

Signature

# Health check endpoints
GET /healthcheck    # Jawn, AI Gateway, Worker API
GET /ping           # ClickHouse

Import

# For running the E2E test suite
cd e2e
yarn install
npx jest tests/on-push/ci-infra/health.test.ts

I/O Contract

Inputs

Name Type Required Description
AI_GATEWAY_URL string No AI Gateway base URL (default: http://localhost:8793)
WORKER_API_URL string No Worker API base URL (default: http://localhost:8788)
JAWN_URL string No Jawn API base URL (default: http://localhost:8585)
CLICKHOUSE_URL string No ClickHouse HTTP base URL (default: http://localhost:18123)
POSTGRES_URL string No PostgreSQL connection string (default: postgresql://postgres:postgres@localhost:54322/postgres)

Outputs

Name Type Description
Jawn /healthcheck JSON {"status": "..."} with HTTP 200 when healthy
ClickHouse /ping text Ok.\n with HTTP 200 when healthy
Gateway /healthcheck any HTTP 200 status code when healthy
Worker /healthcheck any HTTP 200 status code when healthy
Test results stdout Jest test pass/fail output with service health summary table

Usage Examples

Basic Usage

# Quick manual health checks using curl

# Check Jawn (backend API)
curl -s http://localhost:8585/healthcheck
# Expected: {"status":"ok"} or similar JSON with HTTP 200

# Check ClickHouse (analytics database)
curl -s http://localhost:18123/ping
# Expected: Ok.

# Check Worker API
curl -s http://localhost:8788/healthcheck
# Expected: HTTP 200

Run E2E Health Check Tests

# Run the full health check test suite
cd e2e
npx jest tests/on-push/ci-infra/health.test.ts --verbose

# Expected output:
# PASS tests/on-push/ci-infra/health.test.ts
#   System Health Checks
#     AI Gateway (Port 8793)
#       should be running and respond to healthcheck
#     Worker API (Port 8788)
#       should be running and respond to healthcheck
#     Jawn API (Port 8585)
#       should be running and respond to healthcheck
#     ClickHouse Database
#       should be accessible and responding
#     All Services
#       should have all critical services running

Test Constants Configuration

The test constants from e2e/lib/constants.ts:

// Service URLs (configurable via environment variables)
export const AI_GATEWAY_URL = process.env.AI_GATEWAY_URL || "http://localhost:8793";
export const OPENAI_PROXY_URL = process.env.OPENAI_PROXY_URL || "http://localhost:8787";
export const WORKER_API_URL = process.env.WORKER_API_URL || "http://localhost:8788";
export const JAWN_URL = process.env.JAWN_URL || "http://localhost:8585";
export const CLICKHOUSE_URL = process.env.CLICKHOUSE_URL || "http://localhost:18123";

// Endpoint paths
export const GATEWAY_ENDPOINTS = {
  CHAT_COMPLETIONS: "/v1/chat/completions",
  HEALTHCHECK: "/healthcheck",
} as const;

export const JAWN_ENDPOINTS = {
  HEALTHCHECK: "/healthcheck",
} as const;

Custom Service URLs

# Run tests against non-default service URLs
JAWN_URL=http://localhost:9090 \
CLICKHOUSE_URL=http://localhost:8123 \
npx jest tests/on-push/ci-infra/health.test.ts

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment