Smoke test api

From FortiumPartners/ai-mesh · View interactive version

Smoke test api is an AI agent skill from the GitHub repository FortiumPartners/ai-mesh. **Quick Reference** - Load this first for fast context (~3KB)

How to use this skill

Skill file

Smoke Test API Skill

Quick Reference - Load this first for fast context (~3KB)

Mission

Execute comprehensive API health smoke tests to validate service availability, response times, and critical endpoint functionality during release workflows.

Core Capabilities

When to Use This Skill

Use this skill when:

Quick Start

1. Load Skill in Agent

skills:
  - name: smoke-test-api
    path: skills/smoke-test-api/SKILL.md

2. Execute Health Checks

const { SmokeTestAPI } = require('./scripts/execute-health-checks.js');

const tester = new SmokeTestAPI({
  baseUrl: 'https://staging.example.com',
  timeout: 5000,
  retries: 2
});

const result = await tester.executeHealthChecks({
  environment: 'staging',
  endpoints: [
    { path: '/health', method: 'GET', expectedStatus: 200 },
    { path: '/api/v1/users', method: 'GET', expectedStatus: 200 }
  ]
});

if (result.passed) {
  console.log('✅ API health checks passed');
} else {
  console.error('❌ API health checks failed');
}

3. Configuration Template

environment: staging
baseUrl: https://staging.example.com
timeout: 5000
retries: 2
endpoints:
  - name: health-check
    path: /health
    method: GET
    expectedStatus: 200
    sla: 100
  - name: list-users
    path: /api/v1/users
    method: GET
    expectedStatus: 200
    sla: 500

API Smoke Test Categories

1. Health Endpoints

2. Critical CRUD Operations

3. Authentication & Authorization

4. Search & Query Operations

5. Error Handling

Performance SLAs

const SLA_TARGETS = {
  health: 100,      // Health endpoints: ≤100ms
  read: 500,        // Read operations: ≤500ms
  write: 1000,      // Write operations: ≤1000ms
  search: 2000,     // Search operations: ≤2000ms
  timeout: 5000     // Global timeout: ≤5000ms
};

Pass/Fail Criteria

Pass: All smoke tests must pass

Fail: Any smoke test failure blocks deployment

Execution Points

API smoke tests are executed at these points in the release workflow:

  1. Pre-Release (before staging deployment): Validate API readiness
  2. Post-Staging (after staging deployment): Verify staging API health
  3. Canary 5% (5% traffic): Test canary API with minimal traffic
  4. Canary 25% (25% traffic): Test canary API with moderate traffic
  5. Canary 100% (100% traffic): Test canary API with full traffic
  6. Post-Production (after production deployment): Verify production API health
  7. Post-Rollback (after rollback): Validate rollback API health

Common Patterns

Pattern 1: Simple Health Check

const result = await tester.testEndpoint({
  path: '/health',
  method: 'GET',
  expectedStatus: 200,
  sla: 100
});

Pattern 2: Authenticated Request

const result = await tester.testEndpoint({
  path: '/api/v1/users',
  method: 'GET',
  expectedStatus: 200,
  sla: 500,
  headers: {
    'Authorization': `Bearer ${token}`
  }
});

Pattern 3: POST with Body

const result = await tester.testEndpoint({
  path: '/api/v1/users',
  method: 'POST',
  expectedStatus: 201,
  sla: 1000,
  body: {
    name: 'Test User',
    email: 'test@example.com'
  }
});

Output Format

{
  passed: true,
  details: {
    totalEndpoints: 10,
    passed: 10,
    failed: 0,
    executionTime: 1234
  },
  reason: 'API smoke tests passed: All 10 endpoints responding',
  metrics: {
    endpointsPassed: 10,
    endpointsFailed: 0,
    averageResponseTime: 123,
    executionTime: 1234
  },
  results: [
    {
      endpoint: '/health',
      method: 'GET',
      status: 200,
      responseTime: 45,
      sla: 100,
      passed: true
    }
  ]
}

Need More Detail?

For comprehensive documentation including:

Load: skills/smoke-test-api/REFERENCE.md (~15KB)

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.