Skip to content

merge attempt 20.3 -> 22.1#12644

Closed
DaanHoogland wants to merge 9 commits into4.22from
22-merge-issues
Closed

merge attempt 20.3 -> 22.1#12644
DaanHoogland wants to merge 9 commits into4.22from
22-merge-issues

Conversation

@DaanHoogland
Copy link
Contributor

Description

This PR...

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@DaanHoogland
Copy link
Contributor Author

@abh1sar @Pearl1594 @winterhazel , I did a merge forward and after hours of fixing still have some unit test problems. In general I feel quite unsure if all your PRs came out of my tinkering ok. Can you have a look please?

@codecov
Copy link

codecov bot commented Feb 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 3.70%. Comparing base (7324ef4) to head (c7f300f).
⚠️ Report is 9 commits behind head on 4.22.

❗ There is a different number of reports uploaded between BASE (7324ef4) and HEAD (c7f300f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (7324ef4) HEAD (c7f300f)
unittests 1 0
Additional details and impacted files
@@              Coverage Diff              @@
##               4.22   #12644       +/-   ##
=============================================
- Coverage     17.62%    3.70%   -13.92%     
=============================================
  Files          5917      448     -5469     
  Lines        531255    38018   -493237     
  Branches      64951     7035    -57916     
=============================================
- Hits          93639     1409    -92230     
+ Misses       427077    36422   -390655     
+ Partials      10539      187    -10352     
Flag Coverage Δ
uitests 3.70% <ø> (ø)
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Collaborator

@abh1sar abh1sar left a comment

Choose a reason for hiding this comment

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

Looked at Backup and Usage related files. Suggested fixes should get a successful build.

Functionality wise #12549 might not work in 4.22 as there were lots of changes. I'll test and raise a separate PR in 4.22 for that.

PrimaryDataStoreTO primaryDataStore = Mockito.mock(PrimaryDataStoreTO.class);
when(command.getRestoreVolumePools()).thenReturn(Arrays.asList(primaryDataStore));
when(command.getRestoreVolumePaths()).thenReturn(Arrays.asList("/var/lib/libvirt/images/volume-123"));
when(command.getRestoreVolumeUUID()).thenReturn("volume-123");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add when(command.getBackupFiles()).thenReturn(Arrays.asList("volume-123"));

PrimaryDataStoreTO primaryDataStore = Mockito.mock(PrimaryDataStoreTO.class);
when(command.getRestoreVolumePools()).thenReturn(Arrays.asList(primaryDataStore));
when(command.getRestoreVolumePaths()).thenReturn(Arrays.asList("/var/lib/libvirt/images/volume-123"));
when(command.getRestoreVolumeUUID()).thenReturn("volume-123");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add when(command.getBackupFiles()).thenReturn(Arrays.asList("volume-123"));

PrimaryDataStoreTO primaryDataStore = Mockito.mock(PrimaryDataStoreTO.class);
when(command.getRestoreVolumePools()).thenReturn(Arrays.asList(primaryDataStore));
when(command.getRestoreVolumePaths()).thenReturn(Arrays.asList("/var/lib/libvirt/images/volume-123"));
when(command.getRestoreVolumeUUID()).thenReturn("volume-123");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add when(command.getBackupFiles()).thenReturn(Arrays.asList("volume-123"));

PrimaryDataStoreTO primaryDataStore = Mockito.mock(PrimaryDataStoreTO.class);
when(command.getRestoreVolumePools()).thenReturn(Arrays.asList(primaryDataStore));
lenient().when(command.getRestoreVolumePaths()).thenReturn(Arrays.asList("/var/lib/libvirt/images/volume-123"));
lenient().when(command.getRestoreVolumeUUID()).thenReturn("volume-123");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add when(command.getBackupFiles()).thenReturn(Arrays.asList("volume-123"));

import com.cloud.vm.snapshot.VMSnapshot;
import org.apache.cloudstack.quota.constant.QuotaTypes;

public class Value extends GenericPresetVariable {
Copy link
Member

Choose a reason for hiding this comment

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

provisioningType and volumeType need to be converted to Strings in this class

@DaanHoogland
Copy link
Contributor Author

thanks @abh1sar @winterhazel , I will give it another go this afternoon/evening

@DaanHoogland
Copy link
Contributor Author

@abh1sar more errors

[INFO] Running com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest
00:06:55.822 [main] ERROR com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapper - Failed to mount repository {} of type {} to the directory {}
00:06:55.829 [main] ERROR com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapper - Failed to create the tmp mount directory {} for restore
java.io.IOException: Failed to create temp directory
	at java.nio.file.Files.createTempDirectory(Files.java:1007) ~[?:?]
	at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapper.mountBackupDirectory(LibvirtRestoreBackupCommandWrapper.java:188) ~[classes/:?]
	at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapper.execute(LibvirtRestoreBackupCommandWrapper.java:83) ~[classes/:?]
	at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest.testExecuteWithTempDirectoryCreationFailure(LibvirtRestoreBackupCommandWrapperTest.java:472) ~[test-classes/:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) ~[junit-4.13.2.jar:4.13.2]
	at org.mockito.internal.runners.DefaultInternalRunner$1$1.evaluate(DefaultInternalRunner.java:55) ~[mockito-core-5.16.1.jar:?]
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) ~[junit-4.13.2.jar:4.13.2]
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413) ~[junit-4.13.2.jar:4.13.2]
	at org.mockito.internal.runners.DefaultInternalRunner$1.run(DefaultInternalRunner.java:100) ~[mockito-core-5.16.1.jar:?]
	at org.mockito.internal.runners.DefaultInternalRunner.run(DefaultInternalRunner.java:107) ~[mockito-core-5.16.1.jar:?]
	at org.mockito.internal.runners.StrictRunner.run(StrictRunner.java:42) ~[mockito-core-5.16.1.jar:?]
	at org.mockito.junit.MockitoJUnitRunner.run(MockitoJUnitRunner.java:163) ~[mockito-core-5.16.1.jar:?]
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) ~[surefire-junit4-2.22.2.jar:2.22.2]
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273) ~[surefire-junit4-2.22.2.jar:2.22.2]
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) ~[surefire-junit4-2.22.2.jar:2.22.2]
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) ~[surefire-junit4-2.22.2.jar:2.22.2]
	at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384) ~[surefire-booter-2.22.2.jar:2.22.2]
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345) ~[surefire-booter-2.22.2.jar:2.22.2]
	at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126) ~[surefire-booter-2.22.2.jar:2.22.2]
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418) ~[surefire-booter-2.22.2.jar:2.22.2]
[ERROR] Tests run: 11, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.239 s <<< FAILURE! - in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest
[ERROR] testExecuteWithMultipleVolumes(com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest)  Time elapsed: 0.002 s  <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest.testExecuteWithMultipleVolumes(LibvirtRestoreBackupCommandWrapperTest.java:517)

[ERROR] testExecuteWithVmExistsTrue(com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest)  Time elapsed: 0.001 s  <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest.testExecuteWithVmExistsTrue(LibvirtRestoreBackupCommandWrapperTest.java:130)

[ERROR] testExecuteWithVmExistsFalse(com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest)  Time elapsed: 0.001 s  <<< ERROR!
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest.testExecuteWithVmExistsFalse(LibvirtRestoreBackupCommandWrapperTest.java:167)

can you give a clue? cc @Pearl1594

@abh1sar
Copy link
Collaborator

abh1sar commented Feb 17, 2026

[INFO] Running com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest
00:06:55.822 [main] ERROR com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapper - Failed to mount repository {} of type {} to the directory {}
00:06:55.829 [main] ERROR com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapper - Failed to create the tmp mount directory {} for restore
java.io.IOException: Failed to create temp directory

@DaanHoogland this is not an error. it is an expected exception.

[ERROR] Tests run: 11, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.239 s <<< FAILURE! - in com.cloud.hypervisor.kvm.resource.wrapper.LibvirtRestoreBackupCommandWrapperTest

Do you have logs for the 3 Errors? I don't see this in the current failed build logs

Copy link
Collaborator

@abh1sar abh1sar left a comment

Choose a reason for hiding this comment

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

when(command.getBackupFiles()). .. is missing from 3 places

@DaanHoogland
Copy link
Contributor Author

merge forward based on advice here done directly

@github-actions
Copy link

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

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.

8 participants