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

🌱 Add test coverage for VimMachineService #2444

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

laozc
Copy link
Member

@laozc laozc commented Oct 16, 2023

What this PR does / why we need it:
Add test coverage for VimMachineService in pkg/services
Address #2308

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 16, 2023
@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 16, 2023
@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (919c03f) 63.33% compared to head (6cdadaa) 63.89%.
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2444      +/-   ##
==========================================
+ Coverage   63.33%   63.89%   +0.55%     
==========================================
  Files         119      119              
  Lines        8592     8596       +4     
==========================================
+ Hits         5442     5492      +50     
+ Misses       2729     2682      -47     
- Partials      421      422       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@laozc laozc changed the title 🌱 Add test coverage for pkg/services 🌱 Add test coverage for VimMachineService Oct 16, 2023
@laozc
Copy link
Member Author

laozc commented Oct 16, 2023

/retest-required

Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

Question on this @laozc - do you have a way to run these tests individually locally? Especially through an IDE?

I have a problem running tests formatted in this way i.e. using Describe instead of a Test.* function in Intellij/Goland, makes it hard to write tests and hard to review them.

@laozc
Copy link
Member Author

laozc commented Oct 18, 2023

Question on this @laozc - do you have a way to run these tests individually locally? Especially through an IDE?

I have a problem running tests formatted in this way i.e. using Describe instead of a Test.* function in Intellij/Goland, makes it hard to write tests and hard to review them.

I wrote the test and tested it with the help of Goland which could tell me the coverage in details.
Only one drawback that these tests could not be run independently.

What did you meet when you were running these tests?

@chrischdi
Copy link
Member

Only one drawback that these tests could not be run independently.

I think that's the main point Killian thought of.
Maybe we can converge to the pattern we use in CAPI to have a TestMain func and by that are able to run the tests independently, at least for the new tests we are introducing.
With that said: I don't know how much we would need to change for that 🤔

@laozc
Copy link
Member Author

laozc commented Oct 19, 2023

I believe a plugin Ginkgo needs to be installed to support running the test separately in Goland/IntelliJ IDEA.
We have a few tests written in Ginkgo at the moment.

@killianmuldoon
Copy link
Contributor

The Ginkgo plugin does work which is good for existing tests. Going forward though I think we should conform to the upstream CAPI policy described here.

In Cluster API you MUST use ginkgo only for E2E tests, where it is required to leverage the support for running specs in parallel; in any case, developers MUST NOT use the table driven extension DSL (DescribeTable, Entry commands) which is considered unintuitive.

I'll make a comment to this effect on the umbrella issue too.

@laozc
Copy link
Member Author

laozc commented Oct 27, 2023

Thanks for the info.
I took some time to move all the tests in this file away from Ginkgo.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 6, 2023
@sbueringer
Copy link
Member

Sorry, I'll get back to this in a bit. I want to get one bigger change merged first (#2527). Then we can rebase / review / merge this PR

@sbueringer
Copy link
Member

@laozc #2527 will merge in a bit. Do you have time to rebase this PR once #2527 is merged?

@laozc
Copy link
Member Author

laozc commented Dec 13, 2023

Sure. Let me rebase it.

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 18, 2023
@sbueringer
Copy link
Member

Thank you very much!

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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
Copy link
Contributor

LGTM label has been added.

Git tree hash: 20bf5f88212315683841005af9a7e06aeb3ef7ae

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 20, 2023
@k8s-ci-robot k8s-ci-robot merged commit d8bb2e3 into kubernetes-sigs:main Dec 20, 2023
17 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.9 milestone Dec 20, 2023
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants