From d35cd2d7d42a29a05d1b82e9422563a47c9aa851 Mon Sep 17 00:00:00 2001 From: biondizzle Date: Wed, 1 Apr 2026 02:38:47 +0000 Subject: [PATCH] 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 --- README.md | 8 ++++++-- test-metrics.py | 14 +++++++------- test-metrics.sh | 14 ++++++++------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 001c9bf..3d2e4dd 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,9 @@ kubectl -n m3db get svc m3coordinator-lb **Quick connectivity test:** ```bash -./test-metrics.sh +./test-metrics.sh +# 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 +python3 test-metrics.py +# Example: +python3 test-metrics.py https://m3db.vultrlabs.dev:7201 ``` Writes a test metric via Prometheus remote_write and reads it back. diff --git a/test-metrics.py b/test-metrics.py index f2878de..1f9843d 100644 --- a/test-metrics.py +++ b/test-metrics.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 """ Test script for M3DB read/write functionality. -Usage: python3 test-metrics.py +Usage: python3 test-metrics.py """ import sys @@ -11,12 +11,12 @@ import requests def main(): if len(sys.argv) < 2: - print("Usage: python3 test-metrics.py ") - print("Example: python3 test-metrics.py 192.168.1.100") + print("Usage: python3 test-metrics.py ") + 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: diff --git a/test-metrics.sh b/test-metrics.sh index 875309e..9ef5db9 100755 --- a/test-metrics.sh +++ b/test-metrics.sh @@ -1,19 +1,21 @@ #!/bin/bash # # Simple M3DB connectivity test -# Usage: ./test-metrics.sh +# Usage: ./test-metrics.sh # set -e -LB_IP="${1:-}" -if [ -z "$LB_IP" ]; then - echo "Usage: $0 " - echo "Example: $0 192.168.1.100" +BASE_URL="${1:-}" +if [ -z "$BASE_URL" ]; then + echo "Usage: $0 " + 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}"