feat: Python(Locust) + Go(boomer) 混合压测框架(演示版)
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
// TestTransportPool:连接池调优参数必须落在 client 实际使用的 transport 上,
|
||||
// 而不是一个从未被引用的变量(否则调优静默失效)。
|
||||
func TestTransportPool(t *testing.T) {
|
||||
c := NewAPIClient("http://127.0.0.1:1")
|
||||
tr := c.Transport()
|
||||
if tr == nil {
|
||||
t.Fatal("client.Transport 为 nil:连接池配置根本没有被引用")
|
||||
}
|
||||
if tr.MaxIdleConnsPerHost < 1000 {
|
||||
t.Fatalf("MaxIdleConnsPerHost = %d,期望 >= 1000(调优未生效)",
|
||||
tr.MaxIdleConnsPerHost)
|
||||
}
|
||||
if tr.MaxConnsPerHost < 1000 {
|
||||
t.Fatalf("MaxConnsPerHost = %d,期望 >= 1000", tr.MaxConnsPerHost)
|
||||
}
|
||||
if tr.MaxIdleConns < 1000 {
|
||||
t.Fatalf("MaxIdleConns = %d,期望 >= 1000", tr.MaxIdleConns)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user