Docker Compose Testing Guide

🐳 Complete Testing Workflow

This guide shows you how to test your plugin build artifacts using the Docker Compose setup, ensuring everything works before deployment.

🎯 Quick Start Testing

1. Full Test Cycle

# Clean build and test everything
npm run build
docker compose down
docker compose up -d

2. Access Testing Environment

πŸ§ͺ Detailed Testing Steps

Step 1: Build and Prepare

# 1. Clean previous builds
rm -rf dist/
rm -f *.zip

# 2. Install dependencies (if needed)
npm install

# 3. Run quality checks
npm run typecheck
npm run lint

# 4. Build the plugin
npm run build

# 5. Verify build output
ls -la dist/

Expected output:

dist/
β”œβ”€β”€ CHANGELOG.md
β”œβ”€β”€ LICENSE
β”œβ”€β”€ README.md
β”œβ”€β”€ module.js      # Main plugin file
β”œβ”€β”€ module.js.map  # Source map
β”œβ”€β”€ plugin.json    # Plugin metadata
└── img/           # Assets

Step 2: Start Test Environment

# Stop any existing containers
docker compose down

# Start fresh environment
docker compose up -d

# Check all services are running
docker compose ps

Expected services:

Step 3: Verify Services

# Test Prometheus
curl http://localhost:9090/-/healthy
# Expected: Prometheus is Healthy.

# Test Blackbox Exporter
curl http://localhost:9115/
# Expected: HTML page loads

# Test Grafana
curl http://localhost:3001/api/health
# Expected: {"database":"ok","version":"..."}

Step 4: Plugin Testing in Grafana

4.1 Login to Grafana

4.2 Verify Plugin Installation

4.3 Create Test Dashboard

4.4 Test Basic Query

probe_success

Expected Results:

Step 5: Advanced Testing

5.1 Test All Display Modes

# In panel options, test:
- Display Mode: List, Grid, Compact
- Display Level: Ultra-minimal, Minimal, Full

5.2 Test Custom Names

{
  "https://google.com": "Google Search",
  "https://github.com": "GitHub",
  "http://prometheus:9090": "Prometheus"
}

5.3 Test Different Queries

# Specific services
probe_success{instance="https://google.com"}

# With response time
{__name__=~"probe_success|probe_duration_seconds"}

# Filtered by job
probe_success{job="blackbox"}

Step 6: Performance Testing

6.1 Load Testing

6.2 Error Handling

# Test invalid query
invalid_metric_name

# Test no results
probe_success{instance="nonexistent"}

πŸ” Troubleshooting

Plugin Not Loading

# Check Grafana logs
docker compose logs grafana

# Common issues:
- plugin.json syntax errors
- Missing module.js
- Permission issues with mounted volume

No Data Showing

# Check Prometheus targets
curl http://localhost:9090/api/v1/targets

# Check if blackbox exporter is working
curl "http://localhost:9115/probe?target=https://google.com&module=http_2xx"

Services Not Responding

# Restart all services
docker compose restart

# Check service health
docker compose ps
docker compose logs [service-name]

🧽 Testing Checklist

Build Quality

Container Environment

Plugin Functionality

User Experience

πŸ”„ Cleanup

# Stop and remove containers
docker compose down

# Remove volumes (if needed)
docker compose down -v

# Clean build artifacts
npm run clean

πŸŽ† Success Criteria

Your plugin is ready for release when:

  1. βœ… All automated tests pass
  2. βœ… Plugin loads in Grafana without errors
  3. βœ… Basic functionality works with real data
  4. βœ… All display modes render correctly
  5. βœ… Configuration options work as expected
  6. βœ… Error scenarios are handled gracefully
  7. βœ… Performance is acceptable under load
  8. βœ… No memory leaks detected

Ready to release! πŸš€