-
Notifications
You must be signed in to change notification settings - Fork 121
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
add unit test for vineyardctl #1396
Conversation
Easy and customizable dashboards for your build system. Learn more about Stoat ↗︎ Static Hosting
|
🎊 PR Preview 8a14dbc4324ea61c995467d2707a960cd2fda80c has been successfully built and deployed to https://deploy-preview-pr-1396--v6d.netlify.app |
Hi, @zhuyi1159, thanks for the contribution and It's very nice that you can attempt to propose a PR. However, the current pr is at a very early stage, and I suggest moving it to draft and reopening it when it's ready for review. As for your question, we highly recommend writing the related unit test for each file to improve the test coverage, and the unit test coverage should be more than 80%. Some tips for you: |
Thank you for your guidance. Now I have generated corresponding test files (except for the utils subfolder) for almost every go file in the cmd directory by using gotests and resubmitted a commit. Does this comply with regulations? If there are any non-compliance areas, please let me know and I will be very happy to make corrections |
The framework looks good to me, but you need to fulfill the test cases in the blank named |
name string | ||
want *cobra.Command | ||
}{ | ||
// TODO: Add test cases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Insert your test cases in all test files.
I have completed the unit tests for 'create' and 'delete' two folders, and running the 'go test' command shows that they pass. However, because I don't have much knowledge about Go language and Kubernetes, it took me a long time to write the test cases, and I'm not sure if they are compliant even though the 'go test' command passed. Is there any technique for writing test cases? Also, the deadline for submitting the application is approaching, can I submit my OSPP application first? |
You'd better to understand what the command will do and then write the unit tests. No problem, just go ahead for OSPP. |
✅ Deploy Preview for v6d ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use English for comments.
@zhuyi1159 The update looks better than the original one, but the current design only the default configurations of flags. It's better to add some test cases for the command itself. There is an example |
8bda147
to
b438f0e
Compare
What do these changes do?
This is my first attempt to submit a PR, and I have added a main_test.go test file for vineyardctl , but there are multiple folders such as 'create' and 'delete' in the cmd directory, and each folder has multiple files. I don't know if I should write a test file for each of these files. I would be very grateful if my doubts can be answered.
Related issue number
Fixes #1301