Update test scripts to accept full URL instead of LB_IP

- test-metrics.sh and test-metrics.py now take a full URL with port
- Supports both HTTP and HTTPS endpoints
- Updated README with new usage examples
This commit is contained in:
2026-04-01 02:38:47 +00:00
parent a8469f79d7
commit d35cd2d7d4
3 changed files with 21 additions and 15 deletions

View File

@@ -75,7 +75,9 @@ kubectl -n m3db get svc m3coordinator-lb
**Quick connectivity test:**
```bash
./test-metrics.sh <LB_IP>
./test-metrics.sh <BASE_URL>
# Example:
./test-metrics.sh https://m3db.vultrlabs.dev:7201
```
This script verifies:
@@ -87,7 +89,9 @@ This script verifies:
**Full read/write test (Python):**
```bash
pip install requests python-snappy
python3 test-metrics.py <LB_IP>
python3 test-metrics.py <BASE_URL>
# Example:
python3 test-metrics.py https://m3db.vultrlabs.dev:7201
```
Writes a test metric via Prometheus remote_write and reads it back.

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""
Test script for M3DB read/write functionality.
Usage: python3 test-metrics.py <LB_IP>
Usage: python3 test-metrics.py <BASE_URL>
"""
import sys
@@ -11,12 +11,12 @@ import requests
def main():
if len(sys.argv) < 2:
print("Usage: python3 test-metrics.py <LB_IP>")
print("Example: python3 test-metrics.py 192.168.1.100")
print("Usage: python3 test-metrics.py <BASE_URL>")
print("Example: python3 test-metrics.py https://m3db.vultrlabs.dev:7201")
print(" python3 test-metrics.py http://192.168.1.100:7201")
sys.exit(1)
host = sys.argv[1]
base_url = f"http://{host}:7201"
base_url = sys.argv[1].rstrip('/')
# Generate unique metric name with timestamp to avoid conflicts
ts = int(time.time())
@@ -24,7 +24,7 @@ def main():
metric_value = random.randint(1, 1000)
print(f"=== M3DB Metrics Test ===")
print(f"Host: {host}")
print(f"URL: {base_url}")
print(f"Metric: {metric_name}")
print(f"Value: {metric_value}")
print()
@@ -42,7 +42,7 @@ def main():
# Let's use the query endpoint to verify coordinator is up first
# Check coordinator health
health_url = f"{base_url}/api/v1/services/m3db/health"
health_url = f"{base_url}/health"
try:
resp = requests.get(health_url, timeout=10)
if resp.status_code == 200:

View File

@@ -1,19 +1,21 @@
#!/bin/bash
#
# Simple M3DB connectivity test
# Usage: ./test-metrics.sh <LB_IP>
# Usage: ./test-metrics.sh <BASE_URL>
#
set -e
LB_IP="${1:-}"
if [ -z "$LB_IP" ]; then
echo "Usage: $0 <LB_IP>"
echo "Example: $0 192.168.1.100"
BASE_URL="${1:-}"
if [ -z "$BASE_URL" ]; then
echo "Usage: $0 <BASE_URL>"
echo "Example: $0 https://m3db.vultrlabs.dev:7201"
echo " $0 http://192.168.1.100:7201"
exit 1
fi
BASE_URL="http://${LB_IP}:7201"
# Remove trailing slash if present
BASE_URL="${BASE_URL%/}"
echo "=== M3DB Connectivity Test ==="
echo "Target: ${BASE_URL}"