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

View File

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

View File

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