You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "gzhao9 (via GitHub)" <gi...@apache.org> on 2023/10/24 18:07:40 UTC
[PR] Update XenServer610WrapperTest.java [cloudstack]
gzhao9 opened a new pull request, #8139:
URL: https://github.com/apache/cloudstack/pull/8139
### Description
This PR addresses a problem analogous to the one presented in Issue #8088. The core of the issue is repetitive mock object creation for `VolumeTO` within the test suite of `XenServer610WrapperTest.java`. In this refactoring process, I have streamlined the mock creation process for `VolumeTO` to enhance code maintainability and reduce redundancy.
#### Proposed Changes
Aiming to provide a solution similar to what has been described for Issue #8088, I've introduced a method named `MockVolumeTO(String path)`. This method is specifically crafted to create consistent mock objects for `VolumeTO` based on the supplied path.
#### Benefits of the Proposed Refactoring:
- **The utilization of the `MockVolumeTO(String path)` method greatly simplifies the test cases within `XenServer610WrapperTest.java`, ensuring they are more comprehensible and easier to manage.**
- **Should there be a necessity in the future to modify the `VolumeTO` mock creation process, developers can easily implement these changes within the `MockVolumeTO` method, preventing the need for dispersed modifications across the test class.**
<!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
**Fixes: Issue similar to #8088**
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update XenServer610WrapperTest.java [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8139:
URL: https://github.com/apache/cloudstack/pull/8139#issuecomment-1779474062
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update XenServer610WrapperTest.java [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland closed pull request #8139: Update XenServer610WrapperTest.java
URL: https://github.com/apache/cloudstack/pull/8139
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update XenServer610WrapperTest.java [cloudstack]
Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud commented on code in PR #8139:
URL: https://github.com/apache/cloudstack/pull/8139#discussion_r1371221388
##########
plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer610WrapperTest.java:
##########
@@ -259,8 +259,8 @@ public void testMigrateWithStorageSendCommand() {
final Connection conn = Mockito.mock(Connection.class);
final VirtualMachineTO vmSpec = Mockito.mock(VirtualMachineTO.class);
- final VolumeTO volume1 = Mockito.mock(VolumeTO.class);
- final VolumeTO volume2 = Mockito.mock(VolumeTO.class);
+ final VolumeTO volume1 =MockVolumeTO(path);
Review Comment:
```suggestion
final VolumeTO volume1 = MockVolumeTO(path);
```
##########
plugins/hypervisors/xenserver/src/test/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/XenServer610WrapperTest.java:
##########
@@ -481,4 +475,9 @@ public void testXenServer610MigrateVolumeCommandWrapper() {
assertFalse(answer.getResult());
}
+ VolumeTO MockVolumeTO(String path){
Review Comment:
```suggestion
VolumeTO MockVolumeTO(String path){
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update XenServer610WrapperTest.java [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #8139:
URL: https://github.com/apache/cloudstack/pull/8139#issuecomment-1779471194
@blueorangutan package
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update XenServer610WrapperTest.java [cloudstack]
Posted by "rohityadavcloud (via GitHub)" <gi...@apache.org>.
rohityadavcloud merged PR #8139:
URL: https://github.com/apache/cloudstack/pull/8139
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update XenServer610WrapperTest.java [cloudstack]
Posted by "blueorangutan (via GitHub)" <gi...@apache.org>.
blueorangutan commented on PR #8139:
URL: https://github.com/apache/cloudstack/pull/8139#issuecomment-1779588533
Packaging result [SF]: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: el9 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 7513
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update XenServer610WrapperTest.java [cloudstack]
Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland closed pull request #8139: Update XenServer610WrapperTest.java
URL: https://github.com/apache/cloudstack/pull/8139
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Update XenServer610WrapperTest.java [cloudstack]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #8139:
URL: https://github.com/apache/cloudstack/pull/8139#issuecomment-1778456255
## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/8139?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#8139](https://app.codecov.io/gh/apache/cloudstack/pull/8139?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (b6369bc) into [main](https://app.codecov.io/gh/apache/cloudstack/commit/543c54c7189937fe15e2c74db2277795e13a7a1c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (543c54c) will **decrease** coverage by `23.37%`.
> The diff coverage is `n/a`.
```diff
@@ Coverage Diff @@
## main #8139 +/- ##
============================================
- Coverage 28.15% 4.79% -23.37%
============================================
Files 5111 345 -4766
Lines 360669 26102 -334567
Branches 52700 4493 -48207
============================================
- Hits 101562 1252 -100310
+ Misses 245113 24715 -220398
+ Partials 13994 135 -13859
```
| [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/8139/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [simulator-marvin-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8139/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/8139/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.79% <ø> (ø)` | |
| [unit-tests](https://app.codecov.io/gh/apache/cloudstack/pull/8139/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
[see 4766 files with indirect coverage changes](https://app.codecov.io/gh/apache/cloudstack/pull/8139/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org