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

Adds UT for trace package in utils #72

Merged
merged 1 commit into from
Jan 31, 2019

Conversation

ashishranjan738
Copy link
Contributor

Signed-off-by: Ashish Ranjan ashishranjan738@gmail.com

This PR adds UT for trace package in utils repository

fixes: #69

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 25, 2019
@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Jan 25, 2019
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Jan 25, 2019
@ashishranjan738
Copy link
Contributor Author

/assign @dims

@ashishranjan738
Copy link
Contributor Author

/assign @deads2k

@dims
Copy link
Member

dims commented Jan 25, 2019

@ashishranjan738

  • LogIfLong() is not tested ... if we add say 3 steps and the 2nd step takes longer than the other two, then the 2nd step would be logged essentially
  • Log() needs to be tested too ... if there are n steps then the logs should have all the steps

trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
@ashishranjan738
Copy link
Contributor Author

ashishranjan738 commented Jan 25, 2019

@ashishranjan738

  • LogIfLong() is not tested ... if we add say 3 steps and the 2nd step takes longer than the other two, then the 2nd step would be logged essentially
  • Log() needs to be tested too ... if there are n steps then the logs should have all the steps

@dims
Added but I think we should not test these methods as these methods don't mutate any state they just logs some info. Ref : https://stackoverflow.com/questions/22606307/how-to-unit-test-a-function-that-does-not-return-anything

@dims
Copy link
Member

dims commented Jan 25, 2019

@ashishranjan738 please do add tests for the above :) we want to simulate how we use the methods so we don't break the contract when we make changes to the code in this repo.

@dims
Copy link
Member

dims commented Jan 25, 2019

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 25, 2019
@ashishranjan738
Copy link
Contributor Author

ashishranjan738 commented Jan 26, 2019

@dims added the tests for Log and LogIfLong in the second commit as requested.

trace/trace_test.go Outdated Show resolved Hide resolved
@dims
Copy link
Member

dims commented Jan 30, 2019

@ashishranjan738 thanks! please squash the commits and we can proceed

@ashishranjan738
Copy link
Contributor Author

@dims done

@dims
Copy link
Member

dims commented Jan 31, 2019

/approve
/hold cancel

will leave others who have reviewed this for lgtm

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jan 31, 2019
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
trace/trace_test.go Outdated Show resolved Hide resolved
@andrewsykim
Copy link
Member

Few more comments, lgtm otherwise :)

Signed-off-by: Ashish Ranjan <ashishranjan738@gmail.com>

This PR adds UT for trace package in utils repository
@andrewsykim
Copy link
Member

andrewsykim commented Jan 31, 2019

/lgtm

Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 31, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewsykim, ashishranjan738, dims

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 4ae6e76 into kubernetes:master Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need tests for trace package
5 participants