Smoke test database

From FortiumPartners/ai-mesh · View interactive version

Smoke test database 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 Database Skill

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

Mission

Execute comprehensive database smoke tests to validate connectivity, query performance, data integrity, and backup/restore operations 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-database
    path: skills/smoke-test-database/SKILL.md

2. Execute Database Tests

const { SmokeTestDatabase } = require('./scripts/test-connectivity.js');

const tester = new SmokeTestDatabase({
  type: 'postgresql',  // or 'mysql', 'mongodb', 'redis'
  host: 'localhost',
  port: 5432,
  database: 'staging_db',
  username: 'app_user',
  password: process.env.DB_PASSWORD
});

const result = await tester.executeTests({
  environment: 'staging',
  tests: ['connectivity', 'query-performance', 'schema-validation']
});

if (result.passed) {
  console.log('✅ Database smoke tests passed');
} else {
  console.error('❌ Database smoke tests failed');
}

3. Configuration Template

environment: staging
database:
  type: postgresql
  host: staging-db.example.com
  port: 5432
  database: app_staging
  username: app_user
  password: ${DB_PASSWORD}
  ssl: true
  poolSize: 10
tests:
  - connectivity
  - query-performance
  - schema-validation
  - data-integrity

Database Smoke Test Categories

1. Connectivity Tests

2. Query Performance Tests

3. Schema Validation

4. Data Integrity Tests

5. Replication Health

6. Backup Validation

Performance SLAs

const SLA_TARGETS = {
  connectivity: 1000,     // Connection: ≤1000ms
  simpleQuery: 10,        // SELECT 1: ≤10ms
  tableQuery: 50,         // Table scan: ≤50ms
  joinQuery: 200,         // Multi-table join: ≤200ms
  writeOperation: 100,    // INSERT/UPDATE/DELETE: ≤100ms
  replicationLag: 1000,   // Replication lag: ≤1000ms
  timeout: 30000          // Global timeout: ≤30000ms
};

Pass/Fail Criteria

Pass: All smoke tests must pass

Fail: Any smoke test failure blocks deployment

Execution Points

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

  1. Pre-Release (before staging deployment): Validate database readiness and migrations
  2. Post-Staging (after staging deployment): Verify database health after deployment
  3. Canary 5% (5% traffic): Test database connection pooling with minimal load
  4. Canary 25% (25% traffic): Validate database performance under moderate load
  5. Canary 100% (100% traffic): Test database at full production load
  6. Post-Production (after production deployment): Verify production database health
  7. Post-Rollback (after rollback): Validate rollback database state and schema

Common Patterns

Pattern 1: Simple Connectivity Test

const result = await tester.testConnectivity({
  timeout: 5000,
  retries: 2
});

Pattern 2: Query Performance Test

const result = await tester.testQueryPerformance({
  queries: [
    { sql: 'SELECT 1', sla: 10 },
    { sql: 'SELECT * FROM users LIMIT 1', sla: 50 }
  ]
});

Pattern 3: Schema Validation

const result = await tester.validateSchema({
  tables: ['users', 'products', 'orders'],
  checkIndexes: true,
  checkConstraints: true
});

Pattern 4: Data Integrity Check

const result = await tester.validateDataIntegrity({
  checks: [
    { table: 'users', expected: { min: 100, max: 1000000 } },
    { table: 'products', constraint: 'price > 0' },
    { query: 'SELECT COUNT(*) FROM orders WHERE user_id NOT IN (SELECT id FROM users)', expected: 0 }
  ]
});

Output Format

{
  passed: true,
  details: {
    totalTests: 6,
    passed: 6,
    failed: 0,
    executionTime: 1234
  },
  reason: 'Database smoke tests passed: All 6 tests passing',
  metrics: {
    testsPassed: 6,
    testsFailed: 0,
    averageQueryTime: 45,
    maxQueryTime: 198,
    executionTime: 1234
  },
  results: [
    {
      test: 'connectivity',
      category: 'Connection',
      passed: true,
      duration: 234,
      sla: 1000
    },
    {
      test: 'query-performance',
      category: 'Performance',
      passed: true,
      duration: 45,
      sla: 50,
      details: {
        queries: 5,
        averageTime: 45,
        maxTime: 198
      }
    }
  ]
}

Database Type Support

PostgreSQL

MySQL

MongoDB

Redis

Need More Detail?

For comprehensive documentation including:

Load: skills/smoke-test-database/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.