apisix/ssl_manager/test_example.sh

44 lines
1.3 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 测试脚本使用示例
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "APISIX SSL 证书自动申请测试"
echo "================================"
echo ""
# 示例1: 使用自动生成的测试域名
echo "示例1: 使用自动生成的测试域名(测试完成后自动清理)"
echo "python3 $SCRIPT_DIR/test_ssl_auto.py"
echo ""
# 示例2: 指定测试域名
echo "示例2: 指定测试域名"
echo "python3 $SCRIPT_DIR/test_ssl_auto.py --domain test.example.com"
echo ""
# 示例3: 使用环境变量配置(可选)
echo "示例3: 使用环境变量配置(可选)"
echo "export APISIX_ADMIN_URL='http://localhost:9180'"
echo "export APISIX_ADMIN_KEY='your-key'"
echo "python3 $SCRIPT_DIR/test_ssl_auto.py --domain test.example.com"
echo ""
# 示例4: 测试完成后不清理(保留测试数据)
echo "示例4: 测试完成后不清理(保留测试数据)"
echo "python3 $SCRIPT_DIR/test_ssl_auto.py --domain test.example.com --no-cleanup"
echo ""
# 示例5: 强制清理
echo "示例5: 强制清理测试数据"
echo "python3 $SCRIPT_DIR/test_ssl_auto.py --domain test.example.com --cleanup"
echo ""
echo "运行测试..."
echo ""
# 实际运行测试使用默认配置staging 模式)
python3 "$SCRIPT_DIR/test_ssl_auto.py" --cleanup