(t *testing.T)
| 93 | log.Println(httpClient.StatusCode()) |
| 94 | } |
| 95 | func 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 | |
| 121 | func TestNewReq(t *testing.T) { |
| 122 | log.Println("Ghttp test new") |
nothing calls this directly
no test coverage detected