f1.sh 1 KB
# user-service 可能有上下文路径 /api
echo "=== Testing user-service with context path ==="
kubectl exec -n ecommerce -it $(kubectl get pods -n ecommerce -l app=user-service -o jsonpath='{.items[0].metadata.name}') -- sh -c "
echo '1. Testing /api/actuator/health:'
wget -q -O- http://localhost:8080/api/actuator/health || echo 'Failed'
echo ''
echo '2. Testing /api/actuator:'
wget -q -O- http://localhost:8080/api/actuator || echo 'Failed'
"

# product-service 可能也有上下文路径
echo "=== Testing product-service with context path ==="
kubectl exec -n ecommerce -it $(kubectl get pods -n ecommerce -l app=product-service -o jsonpath='{.items[0].metadata.name}') -- sh -c "
echo '1. Testing /api/actuator/health:'
wget -q -O- http://localhost:8080/api/actuator/health || echo 'Failed'
echo ''
echo '2. Testing /api/actuator:'
wget -q -O- http://localhost:8080/api/actuator || echo 'Failed'
echo ''
echo '3. Testing /management/health:'
wget -q -O- http://localhost:8080/management/health || echo 'Failed'
"