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

Conversation

Deardrops
Copy link
Contributor

@Deardrops Deardrops commented Nov 15, 2019

What problem does this PR solve?

Improving test coverage of server package

Add test coverage for

tidb/server/http_status.go

Lines 204 to 228 in b274eb2

// dump config
fw, err = zw.Create("config")
if err != nil {
serveError(w, http.StatusInternalServerError, fmt.Sprintf("Create zipped %s fail: %v", "config", err))
return
}
js, err := json.MarshalIndent(config.GetGlobalConfig(), "", " ")
if err != nil {
serveError(w, http.StatusInternalServerError, fmt.Sprintf("get config info fail%v", err))
return
}
_, err = fw.Write(js)
terror.Log(err)
// dump version
fw, err = zw.Create("version")
if err != nil {
serveError(w, http.StatusInternalServerError, fmt.Sprintf("Create zipped %s fail: %v", "version", err))
return
}
_, err = fw.Write([]byte(printer.GetTiDBInfo()))
terror.Log(err)
err = zw.Close()
terror.Log(err)

What is changed and how it works?

For testing /debug/zip api, We copy data in the http response to local temp file for ensuring data transport finished. This way also ensure all logic in /debug/zip will executed.

This PR is part of #11760

Check List

Tests

  • Integration test

@sre-bot
Copy link
Contributor

sre-bot commented Nov 15, 2019

Thanks for your PR.
This PR will be closed by bot because you already had 3 opened PRs, close or merge them before submitting a new one.
#12550 , #13168 , #13211

@sre-bot
Copy link
Contributor

sre-bot commented Nov 15, 2019

Thanks for your PR.
This PR will be closed by bot because you already had 3 opened PRs, close or merge them before submitting a new one.
#12550 , #13168 , #13211

@codecov
Copy link

codecov bot commented Nov 15, 2019

Codecov Report

Merging #13486 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #13486   +/-   ##
===========================================
  Coverage   79.9716%   79.9716%           
===========================================
  Files           473        473           
  Lines        116200     116200           
===========================================
  Hits          92927      92927           
  Misses        15945      15945           
  Partials       7328       7328

@Deardrops
Copy link
Contributor Author

/run-all-tests

@Deardrops
Copy link
Contributor Author

/run-all-tests

@Deardrops
Copy link
Contributor Author

/run-unit-test

2 similar comments
@Deardrops
Copy link
Contributor Author

/run-unit-test

@Deardrops
Copy link
Contributor Author

/run-unit-test

@Deardrops
Copy link
Contributor Author

/run-unit-test

@Deardrops
Copy link
Contributor Author

/run-unit-test

1 similar comment
@Deardrops
Copy link
Contributor Author

/run-unit-test

Copy link
Contributor

@djshow832 djshow832 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@djshow832 djshow832 added the status/LGT1 Indicates that a PR has LGTM 1. label Nov 21, 2019
Copy link
Contributor

@reafans reafans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Deardrops Deardrops added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Nov 22, 2019
Copy link
Member

@wjhuang2016 wjhuang2016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, please add the coverage diff next time. From the picture, this PR will improve the coverage from 63.5% to 63.8%
企业微信截图_15743913607369

@Deardrops
Copy link
Contributor Author

/run-all-tests

@Deardrops
Copy link
Contributor Author

/run-all-tests

@Deardrops
Copy link
Contributor Author

/run-unit-test

@Deardrops Deardrops merged commit 06fd934 into pingcap:master Nov 22, 2019
@Deardrops Deardrops deleted the server-debug-zip branch November 22, 2019 03:25
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/server status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants