Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: improve test coverage of /debug/zip api #13486

Merged
merged 7 commits into from
Nov 22, 2019
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions server/http_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,20 @@ func (ts *HTTPHandlerTestSuite) TestHotRegionInfo(c *C) {
func (ts *HTTPHandlerTestSuite) TestDebugZip(c *C) {
ts.startServer(c)
defer ts.stopServer(c)
resp, err := http.Get("http://127.0.0.1:10090/debug/zip")
resp, err := http.Get("http://127.0.0.1:10090/debug/zip?seconds=1")
c.Assert(err, IsNil)
defer resp.Body.Close()
c.Assert(resp.StatusCode, Equals, http.StatusOK)
out, err := os.Create("/tmp/tidb_debug.zip")
c.Assert(err, IsNil)
_, err = io.Copy(out, resp.Body)
c.Assert(err, IsNil)
fileInfo, err := out.Stat()
c.Assert(err, IsNil)
c.Assert(fileInfo.Size(), Greater, int64(0))
err = out.Close()
c.Assert(err, IsNil)
err = os.Remove("/tmp/tidb_debug.zip")
c.Assert(err, IsNil)
err = resp.Body.Close()
c.Assert(err, IsNil)
}