Initial commit
This commit is contained in:
15
.claude-plugin/plugin.json
Normal file
15
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "load-balancer-tester",
|
||||
"description": "Test load balancing strategies with traffic distribution validation and failover testing",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Claude Code Plugin Hub",
|
||||
"email": "[email protected]"
|
||||
},
|
||||
"skills": [
|
||||
"./skills"
|
||||
],
|
||||
"commands": [
|
||||
"./commands"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# load-balancer-tester
|
||||
|
||||
Test load balancing strategies with traffic distribution validation and failover testing
|
||||
37
commands/lb-test.md
Normal file
37
commands/lb-test.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
description: Test load balancer traffic distribution and failover strategies
|
||||
shortcut: lbt
|
||||
---
|
||||
|
||||
# Load Balancer Tester
|
||||
|
||||
Test load balancing strategies including round-robin, least connections, weighted distribution, sticky sessions, and failover scenarios.
|
||||
|
||||
## What You Do
|
||||
|
||||
1. **Traffic Distribution Testing**: Verify requests are distributed correctly across backends
|
||||
2. **Failover Testing**: Test behavior when backends fail
|
||||
3. **Sticky Session Validation**: Ensure session affinity works
|
||||
4. **Health Check Testing**: Verify health checks remove unhealthy backends
|
||||
|
||||
## Output Example
|
||||
|
||||
```javascript
|
||||
describe('Load Balancer Tests', () => {
|
||||
it('distributes traffic evenly with round-robin', async () => {
|
||||
const requests = 100;
|
||||
const backends = ['backend1', 'backend2', 'backend3'];
|
||||
const distribution = await sendRequests(requests);
|
||||
|
||||
backends.forEach(backend => {
|
||||
expect(distribution[backend]).toBeCloseTo(requests / backends.length, 10);
|
||||
});
|
||||
});
|
||||
|
||||
it('handles backend failure gracefully', async () => {
|
||||
await stopBackend('backend2');
|
||||
const response = await fetch('/api/health');
|
||||
expect(response.status).toBe(200);
|
||||
});
|
||||
});
|
||||
```
|
||||
73
plugin.lock.json
Normal file
73
plugin.lock.json
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:jeremylongshore/claude-code-plugins-plus:plugins/testing/load-balancer-tester",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "7cb134ab9ac6d569100d47786c370c9f8532afb7",
|
||||
"treeHash": "edf24c22c97c71d7e6879bfe7593d8bdd8f40095e85342d0c191077949d199ad",
|
||||
"generatedAt": "2025-11-28T10:18:32.205885Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "load-balancer-tester",
|
||||
"description": "Test load balancing strategies with traffic distribution validation and failover testing",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "1c31944165237064cb723cda00d62ea6296d639db2c9b883a7796d4214c9d404"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "97a2a6c1c63f796a8de48ae5e4f4115825507aa0afc8499140b4d88433da5ac1"
|
||||
},
|
||||
{
|
||||
"path": "commands/lb-test.md",
|
||||
"sha256": "99ac7560e4ebd8225a1dc93e6727e4f20ed5137da5d8da85097e6b114c1abf21"
|
||||
},
|
||||
{
|
||||
"path": "skills/load-balancer-tester/SKILL.md",
|
||||
"sha256": "60f5f090bdf1183ea32cfc5eec34622d17154926659f5367d1394c3b7cd2ba6f"
|
||||
},
|
||||
{
|
||||
"path": "skills/load-balancer-tester/references/README.md",
|
||||
"sha256": "0f0ff2482815fabc198f9ab84fd759735c402d7c417c908cb08320950723b0bd"
|
||||
},
|
||||
{
|
||||
"path": "skills/load-balancer-tester/scripts/README.md",
|
||||
"sha256": "22a5964e8757cb2243da12a358622c06a8d4a3ce82d7e25d1580f56e2cf87996"
|
||||
},
|
||||
{
|
||||
"path": "skills/load-balancer-tester/assets/README.md",
|
||||
"sha256": "5d99211170f74a12e47217159a3c17dcfd64c0aa65ad503d0f90e582991c4d49"
|
||||
},
|
||||
{
|
||||
"path": "skills/load-balancer-tester/assets/example_config.conf",
|
||||
"sha256": "ffe098389fc6917522ec51501caa5eab4c06e81cabd16180bb3e6e103c176552"
|
||||
},
|
||||
{
|
||||
"path": "skills/load-balancer-tester/assets/report_template.html",
|
||||
"sha256": "4fb0bed0ac8292acdc3431abb1b5bafc9869ce92fea537993d191dbdc983a858"
|
||||
},
|
||||
{
|
||||
"path": "skills/load-balancer-tester/assets/test_template.json",
|
||||
"sha256": "f05b94a11dd7949f43d9c87392df9ae55aa5d0c723e4c22c188dec545dc1feb5"
|
||||
}
|
||||
],
|
||||
"dirSha256": "edf24c22c97c71d7e6879bfe7593d8bdd8f40095e85342d0c191077949d199ad"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
56
skills/load-balancer-tester/SKILL.md
Normal file
56
skills/load-balancer-tester/SKILL.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
name: testing-load-balancers
|
||||
description: |
|
||||
This skill enables Claude to test load balancing strategies. It validates traffic distribution across backend servers, tests failover scenarios when servers become unavailable, verifies sticky sessions, and assesses health check functionality. Use this skill when the user asks to "test load balancer", "validate traffic distribution", "test failover", "verify sticky sessions", or "test health checks". It is specifically designed for testing load balancing configurations using the `load-balancer-tester` plugin.
|
||||
allowed-tools: Read, Bash, Grep, Glob
|
||||
version: 1.0.0
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
This skill empowers Claude to thoroughly test load balancing configurations, ensuring high availability and optimal performance. It automates the process of validating traffic distribution, simulating server failures, and verifying session persistence.
|
||||
|
||||
## How It Works
|
||||
|
||||
1. **Initiating the Test**: Claude receives a request to test the load balancer.
|
||||
2. **Executing the Test Suite**: Claude uses the `load-balancer-tester` plugin to run a series of tests, including traffic distribution validation, failover testing, sticky session verification, and health check testing.
|
||||
3. **Presenting the Results**: Claude provides a summary of the test results, highlighting any issues or areas for improvement.
|
||||
|
||||
## When to Use This Skill
|
||||
|
||||
This skill activates when you need to:
|
||||
- Validate traffic distribution across backend servers.
|
||||
- Test the load balancer's ability to handle server failures.
|
||||
- Verify that sticky sessions are functioning correctly.
|
||||
- Ensure that health checks are effectively removing unhealthy servers from the pool.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Validating Traffic Distribution
|
||||
|
||||
User request: "Test load balancer traffic distribution for even distribution across servers."
|
||||
|
||||
The skill will:
|
||||
1. Execute the `lb-test` command.
|
||||
2. Analyze the traffic distribution across the backend servers.
|
||||
3. Report whether the traffic is evenly distributed.
|
||||
|
||||
### Example 2: Simulating a Failover Scenario
|
||||
|
||||
User request: "Test failover when one of the backend servers becomes unavailable."
|
||||
|
||||
The skill will:
|
||||
1. Execute the `lb-test` command.
|
||||
2. Simulate a server failure.
|
||||
3. Verify that traffic is redirected to the remaining healthy servers.
|
||||
4. Report on the success of the failover process.
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Configuration**: Ensure the load balancer is properly configured before testing.
|
||||
- **Realistic Scenarios**: Test with realistic traffic patterns and failure scenarios.
|
||||
- **Comprehensive Testing**: Test all aspects of the load balancer, including traffic distribution, failover, sticky sessions, and health checks.
|
||||
|
||||
## Integration
|
||||
|
||||
This skill works independently using the `load-balancer-tester` plugin. It can be used in conjunction with other skills to configure and manage the load balancer before testing.
|
||||
7
skills/load-balancer-tester/assets/README.md
Normal file
7
skills/load-balancer-tester/assets/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for load-balancer-tester skill
|
||||
|
||||
- [ ] test_template.json: JSON template for defining load balancer test configurations.
|
||||
- [ ] report_template.html: HTML template for generating load balancer test reports.
|
||||
- [ ] example_config.conf: Example load balancer configuration file.
|
||||
74
skills/load-balancer-tester/assets/example_config.conf
Normal file
74
skills/load-balancer-tester/assets/example_config.conf
Normal file
@@ -0,0 +1,74 @@
|
||||
# Example Load Balancer Configuration File
|
||||
# This file provides a template for configuring the load balancer settings
|
||||
# to be used with the load-balancer-tester plugin.
|
||||
|
||||
# --- General Configuration ---
|
||||
# Name of the load balancer (used for identification)
|
||||
load_balancer_name = "my-load-balancer"
|
||||
|
||||
# Load balancing strategy:
|
||||
# Options: round-robin, weighted-round-robin, least-connections, ip-hash
|
||||
load_balancing_strategy = "round-robin"
|
||||
|
||||
# --- Backend Server Configuration ---
|
||||
# List of backend servers with their respective weights (if applicable)
|
||||
# Format: "server_address:port:weight"
|
||||
# Example: "192.168.1.10:8080:10", "192.168.1.11:8080:20", "192.168.1.12:8080" (default weight is 1)
|
||||
backend_servers = [
|
||||
"server1.example.com:80:1",
|
||||
"server2.example.com:80:1",
|
||||
"server3.example.com:80:1"
|
||||
]
|
||||
|
||||
# --- Health Check Configuration ---
|
||||
# Health check endpoint for backend servers
|
||||
health_check_endpoint = "/health"
|
||||
|
||||
# Health check interval (in seconds)
|
||||
health_check_interval = 5
|
||||
|
||||
# Health check timeout (in seconds)
|
||||
health_check_timeout = 2
|
||||
|
||||
# Number of consecutive successful health checks required to mark a server as healthy
|
||||
healthy_threshold = 3
|
||||
|
||||
# Number of consecutive failed health checks required to mark a server as unhealthy
|
||||
unhealthy_threshold = 3
|
||||
|
||||
# --- Session Persistence (Sticky Sessions) Configuration ---
|
||||
# Enable or disable sticky sessions
|
||||
sticky_sessions_enabled = false
|
||||
|
||||
# Cookie name for session persistence (if sticky sessions are enabled)
|
||||
sticky_session_cookie_name = "LB_SESSION"
|
||||
|
||||
# --- Failover Configuration ---
|
||||
# Time to wait before considering a server as failed (in seconds)
|
||||
failover_timeout = 10
|
||||
|
||||
# --- Traffic Distribution Validation ---
|
||||
# Number of requests to send for traffic distribution validation
|
||||
number_of_requests = 1000
|
||||
|
||||
# --- Advanced Configuration (Optional) ---
|
||||
# Custom headers to be added to the requests
|
||||
# Format: "header_name:header_value"
|
||||
# Example: "X-Custom-Header:MyValue"
|
||||
custom_headers = [
|
||||
# "X-Request-ID: $RANDOM_UUID" # Example - replace with your desired logic
|
||||
]
|
||||
|
||||
# Request method to use for testing (GET, POST, PUT, DELETE, etc.)
|
||||
request_method = "GET"
|
||||
|
||||
# URL path to request. Defaults to "/" if not provided.
|
||||
request_path = "/"
|
||||
|
||||
# --- Notes ---
|
||||
# - Replace the placeholder values with your actual load balancer configuration.
|
||||
# - Ensure that the backend servers are accessible from the machine running the plugin.
|
||||
# - Adjust the health check parameters based on your application's health check requirements.
|
||||
# - For weighted round-robin, ensure that the weights are integers.
|
||||
# - Remember to save this file with a `.conf` extension (e.g., `my_load_balancer.conf`).
|
||||
# - The plugin will read this file to configure the load balancer testing.
|
||||
204
skills/load-balancer-tester/assets/report_template.html
Normal file
204
skills/load-balancer-tester/assets/report_template.html
Normal file
@@ -0,0 +1,204 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Load Balancer Test Report</title>
|
||||
<style>
|
||||
/* Basic CSS Reset */
|
||||
body, h1, h2, h3, p, ul, li {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
line-height: 1.6;
|
||||
background-color: #f4f4f4;
|
||||
color: #333;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
background-color: #fff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin-bottom: 20px;
|
||||
text-align: center;
|
||||
color: #007bff; /* Primary color */
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 10px;
|
||||
color: #007bff;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 1.2em;
|
||||
margin-bottom: 5px;
|
||||
color: #555;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: disc;
|
||||
margin-left: 20px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.status-good {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.status-bad {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.status-warning {
|
||||
color: orange;
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-bottom: 30px;
|
||||
border-bottom: 1px solid #eee;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.section:last-child {
|
||||
border-bottom: none;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.table th, .table td {
|
||||
border: 1px solid #ddd;
|
||||
padding: 8px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.table th {
|
||||
background-color: #f2f2f2;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 600px) {
|
||||
.container {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.8em;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.3em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Load Balancer Test Report</h1>
|
||||
|
||||
<div class="section">
|
||||
<h2>Test Summary</h2>
|
||||
<p><strong>Test ID:</strong> {{test_id}}</p>
|
||||
<p><strong>Date:</strong> {{test_date}}</p>
|
||||
<p><strong>Load Balancer URL:</strong> {{load_balancer_url}}</p>
|
||||
<p><strong>Overall Status:</strong> <span class="{{overall_status_class}}">{{overall_status}}</span></p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Traffic Distribution Validation</h2>
|
||||
<h3>Expected Distribution:</h3>
|
||||
<p>{{expected_distribution}}</p>
|
||||
<h3>Actual Distribution:</h3>
|
||||
<p>{{actual_distribution}}</p>
|
||||
<h3>Distribution Status: <span class="{{distribution_status_class}}">{{distribution_status}}</span></h3>
|
||||
<p>{{distribution_details}}</p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Failover Testing</h2>
|
||||
<h3>Failover Status: <span class="{{failover_status_class}}">{{failover_status}}</span></h3>
|
||||
<p>{{failover_details}}</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Instance</th>
|
||||
<th>Status Before Failover</th>
|
||||
<th>Status After Failover</th>
|
||||
<th>Response Time (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{failover_table_rows}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Sticky Session Verification</h2>
|
||||
<h3>Sticky Session Status: <span class="{{sticky_session_status_class}}">{{sticky_session_status}}</span></h3>
|
||||
<p>{{sticky_session_details}}</p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Health Check Testing</h2>
|
||||
<h3>Health Check Status: <span class="{{health_check_status_class}}">{{health_check_status}}</span></h3>
|
||||
<p>{{health_check_details}}</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Instance</th>
|
||||
<th>Health Check Endpoint</th>
|
||||
<th>Status Code</th>
|
||||
<th>Response Time (ms)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{health_check_table_rows}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Detailed Logs</h2>
|
||||
<p>{{detailed_logs}}</p>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<h2>Recommendations</h2>
|
||||
<p>{{recommendations}}</p>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p style="text-align: center; font-size: 0.8em; color: #777;">Report generated by Load Balancer Tester</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
62
skills/load-balancer-tester/assets/test_template.json
Normal file
62
skills/load-balancer-tester/assets/test_template.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"_comment": "Load Balancer Test Configuration Template",
|
||||
"test_name": "Example Load Balancer Test",
|
||||
"description": "Tests traffic distribution and failover capabilities of the load balancer.",
|
||||
"target_url": "http://your-load-balancer-url.com",
|
||||
"num_requests": 1000,
|
||||
"concurrency": 10,
|
||||
"request_type": "GET",
|
||||
"request_headers": {
|
||||
"_comment": "Optional headers to include in each request",
|
||||
"Content-Type": "application/json",
|
||||
"X-Test-Header": "lb-tester"
|
||||
},
|
||||
"request_body": null,
|
||||
"distribution_validation": {
|
||||
"_comment": "Configuration for validating traffic distribution across backend servers",
|
||||
"enabled": true,
|
||||
"server_count": 3,
|
||||
"expected_distribution_tolerance": 0.1,
|
||||
"distribution_method": "request_count",
|
||||
"server_identifiers": [
|
||||
"server1",
|
||||
"server2",
|
||||
"server3"
|
||||
],
|
||||
"identifier_extraction_method": "header",
|
||||
"identifier_extraction_header": "X-Server-ID"
|
||||
},
|
||||
"failover_testing": {
|
||||
"_comment": "Configuration for testing failover capabilities",
|
||||
"enabled": true,
|
||||
"server_to_fail": "server2",
|
||||
"failover_wait_time": 10,
|
||||
"requests_after_failover": 200
|
||||
},
|
||||
"sticky_session_verification": {
|
||||
"_comment": "Configuration for verifying sticky sessions",
|
||||
"enabled": false,
|
||||
"session_cookie_name": "JSESSIONID",
|
||||
"requests_per_session": 10
|
||||
},
|
||||
"health_check_testing": {
|
||||
"_comment": "Configuration for testing health check behavior",
|
||||
"enabled": false,
|
||||
"health_check_endpoint": "/health",
|
||||
"expected_status_code": 200,
|
||||
"interval": 5,
|
||||
"duration": 60
|
||||
},
|
||||
"assertions": {
|
||||
"_comment": "Custom assertions to validate the response",
|
||||
"response_time_max": 200,
|
||||
"status_code_min": 200,
|
||||
"status_code_max": 299,
|
||||
"response_contains": null
|
||||
},
|
||||
"reporting": {
|
||||
"_comment": "Reporting configuration",
|
||||
"report_format": "json",
|
||||
"output_file": "lb_test_report.json"
|
||||
}
|
||||
}
|
||||
7
skills/load-balancer-tester/references/README.md
Normal file
7
skills/load-balancer-tester/references/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# References
|
||||
|
||||
Bundled resources for load-balancer-tester skill
|
||||
|
||||
- [ ] load_balancer_api_docs.md: API documentation for interacting with various load balancer types (e.g., AWS ELB, Nginx, HAProxy).
|
||||
- [ ] test_case_examples.md: Examples of different test cases for load balancer testing, including configuration and expected results.
|
||||
- [ ] health_check_best_practices.md: Best practices for configuring and monitoring load balancer health checks.
|
||||
7
skills/load-balancer-tester/scripts/README.md
Normal file
7
skills/load-balancer-tester/scripts/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Scripts
|
||||
|
||||
Bundled resources for load-balancer-tester skill
|
||||
|
||||
- [ ] load_balancer_test.py: Script to execute load balancer tests, including traffic distribution, failover, sticky sessions, and health checks.
|
||||
- [ ] report_generator.py: Script to generate a detailed report of the load balancer test results.
|
||||
- [ ] config_parser.py: Script to parse load balancer configuration files.
|
||||
Reference in New Issue
Block a user