fix(proxy): 更新代理池初始化策略的接口地址和测试逻辑

- 替换main.go中代理池初始化策略的API密钥和参数
- 修改测试用例,增加定时器循环调用初始化和代理获取
- 测试中使用随机UUID模拟订单ID获取代理
- 保证测试用例能持续获取代理结果进行日志输出
This commit is contained in:
danial
2025-12-08 16:34:23 +08:00
parent 622aed094b
commit ff0d6e2d9f
2 changed files with 8 additions and 4 deletions

View File

@@ -8,11 +8,15 @@ import (
"kami/internal/service"
"kami/utility/utils"
"testing"
"time"
)
func Test_sProxyPool_GetProxyByOrderId(t *testing.T) {
service.RegisterProxyPool(New())
_ = service.ProxyPool().InitStrategy(gctx.GetInitCtx(), "http://api.dmdaili.com/dmgetip.asp?apikey=42bab0ac&pwd=1b567c2f286a08e391b5805565fa0882&getnum=1&httptype=1&geshi=1&fenge=3&fengefu=&operate=all", gtime.M)
proxy, err2 := service.ProxyPool().GetProxyByOrderId(t.Context(), utils.GenerateRandomUUID())
t.Log(proxy, err2)
ticker := time.NewTicker(time.Second)
for range ticker.C {
_ = service.ProxyPool().InitStrategy(gctx.GetInitCtx(), "http://api.dmdaili.com/dmgetip.asp?apikey=42bab0ac&pwd=1b567c2f286a08e391b5805565fa0882&getnum=1&httptype=1&geshi=1&fenge=3&fengefu=&operate=all", gtime.M)
proxy, err2 := service.ProxyPool().GetProxyByOrderId(t.Context(), utils.GenerateRandomUUID())
t.Log(proxy, err2)
}
}

View File

@@ -46,7 +46,7 @@ func main() {
glog.Warning(gctx.GetInitCtx(), "AES 密钥初始化失败", err)
}
_ = service.ProxyPool().InitStrategy(gctx.GetInitCtx(), "http://api.dmdaili.com/dmgetip.asp?apikey=1346ef8f&pwd=0a0cdef3a8c1874a3f6c88352df968b8&getnum=1&httptype=1&geshi=1&fenge=1&fengefu=&operate=all", gtime.M)
_ = service.ProxyPool().InitStrategy(gctx.GetInitCtx(), "http://api.dmdaili.com/dmgetip.asp?apikey=42bab0ac&pwd=1b567c2f286a08e391b5805565fa0882&getnum=1&httptype=1&geshi=1&fenge=3&fengefu=&operate=all", gtime.M)
// 测试日志输出
glog.Info(gctx.GetInitCtx(), "OTel可观测性系统初始化完成服务启动")