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

test: unit test for request cache of stream server #1767

Merged
merged 1 commit into from
Jul 30, 2018

Conversation

YaoZengzeng
Copy link
Contributor

@YaoZengzeng YaoZengzeng commented Jul 23, 2018

Signed-off-by: YaoZengzeng [email protected]

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

fixes part of #1756

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Jul 23, 2018

Codecov Report

Merging #1767 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1767      +/-   ##
==========================================
+ Coverage   58.68%   58.72%   +0.03%     
==========================================
  Files         200      200              
  Lines       15565    15565              
==========================================
+ Hits         9135     9141       +6     
+ Misses       5143     5138       -5     
+ Partials     1287     1286       -1
Flag Coverage Δ
#criv1alpha1test 33.3% <100%> (+0.09%) ⬆️
#criv1alpha2test 33.67% <100%> (-0.12%) ⬇️
#integrationtest 37.89% <0%> (-0.02%) ⬇️
#unittest 13.84% <100%> (+0.41%) ⬆️
Impacted Files Coverage Δ
cri/stream/request_cache.go 81.63% <100%> (+18.36%) ⬆️
cri/stream/httpstream/spdy/upgrade.go 54.28% <0%> (-5.72%) ⬇️
ctrd/image.go 79.2% <0%> (-1.99%) ⬇️
cri/v1alpha2/cri.go 65.96% <0%> (-0.18%) ⬇️
daemon/mgr/container.go 53.46% <0%> (+0.15%) ⬆️
cri/stream/errors.go 11.76% <0%> (+11.76%) ⬆️

@YaoZengzeng
Copy link
Contributor Author

@fuweid PTAL.

}
}

func TestRequestCacheTokenUnique(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the original function name should be generateUniqueName rather than uniqueName? WDYT? @YaoZengzeng

@allencloud
Copy link
Collaborator

In this pull request, I read the unit test code in the change, while I think these are quite good.
However, I still have some confusion to share with others:

When adding unit test, which one is better? Unit test for single function, or unit test for com比national logic for procedure?

If we have a function Insert, then we add a unit test TestInsert. This is for function.

If we we have function insert, unique and others, we add a unit test TestRequestCacheBasic which is a combinational logic. Or the latter one is some kind of integration test for couple of functions.

What should we do, or do we need to rule to classify this?

Maybe, for function is a must-do, combinational logic is an option?

Wish to get more input? @YaoZengzeng @fuweid @Letty5411 @chuanchang @HusterWan @zhuangqh

@starnop
Copy link
Contributor

starnop commented Jul 30, 2018

LGTM.

@allencloud
Copy link
Collaborator

Thanks for your review. @starnop

@allencloud allencloud merged commit 7df653e into AliyunContainerService:master Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants