- 修改数据库密码和 Redis 连接信息为新的配置 - 更新配置模型中 Redis 默认主机和密码 - 优化获取代理时日志记录,添加成功日志和失败错误日志 - 测试用例中使用 resty 检测代理有效性,替换 sleep 暂停方式
19 lines
423 B
Go
19 lines
423 B
Go
package utils
|
|
|
|
import (
|
|
"gateway/internal/cache"
|
|
"github.com/go-resty/resty/v2"
|
|
"testing"
|
|
)
|
|
|
|
func TestGetProxy(t *testing.T) {
|
|
cache.Start()
|
|
StartProxyPool()
|
|
channel := []string{"channel_four", "channel_five", "channel_six"}
|
|
for _, c := range channel {
|
|
proxy, _ := GetProxy(t.Context(), "2434534543", c)
|
|
resp, err := resty.New().SetProxy(proxy).R().Get("https://www.qq.com")
|
|
t.Log(resp.StatusCode(), err)
|
|
}
|
|
}
|