MCPcopy Create free account
hub / github.com/code-scan/Goal / TestManyReq

Function TestManyReq

tests/http_test.go:95–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

93 log.Println(httpClient.StatusCode())
94}
95func TestManyReq(t *testing.T) {
96 f, _ := os.OpenFile("cpu.pprof", os.O_CREATE|os.O_RDWR, 0644)
97 pprof.StartCPUProfile(f)
98 defer pprof.StopCPUProfile()
99 var task = make(chan string, 100)
100 for i := 0; i < 100; i++ {
101 go func() {
102 c := Ghttp.New()
103 for {
104 tt := <-task
105 log.Println("GET Task : ", tt)
106 c.New("GET", tt)
107 c.DontRedirect()
108 c.Execute()
109 location := c.GetRespHead("location")
110 log.Println(location)
111 c.Text()
112 defer c.Close()
113 }
114 }()
115 }
116 for i := 0; i < 1000; i++ {
117 task <- "http://qq.com"
118 }
119}
120
121func TestNewReq(t *testing.T) {
122 log.Println("Ghttp test new")

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
NewMethod · 0.80
DontRedirectMethod · 0.80
ExecuteMethod · 0.80
GetRespHeadMethod · 0.80
TextMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected