Skip to content

Commit d36f15a

Browse files
committed
fix UT and schema
1 parent 083badf commit d36f15a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

engine/schema/src/main/resources/META-INF/db/schema-41930to41940.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
--;
2121

2222
-- Add vm_id column to usage_event table for volume usage events
23-
ALTER TABLE `cloud`.`usage_event` ADD COLUMN `vm_id` bigint unsigned NULL COMMENT 'VM ID associated with volume usage events';
24-
ALTER TABLE `cloud_usage`.`usage_event` ADD COLUMN `vm_id` bigint unsigned NULL COMMENT 'VM ID associated with volume usage events';
23+
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.usage_event','vm_id', 'bigint UNSIGNED NULL COMMENT "VM ID associated with volume usage events"');
24+
CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.usage_event','vm_id', 'bigint UNSIGNED NULL COMMENT "VM ID associated with volume usage events"');
2525

2626
-- Add vm_id column to cloud_usage.usage_volume table
27-
ALTER TABLE `cloud_usage`.`usage_volume` ADD COLUMN `vm_id` bigint unsigned NULL COMMENT 'VM ID associated with the volume usage';
27+
CALL `cloud_usage`.`IDEMPOTENT_ADD_COLUMN`('cloud_usage.usage_volume','vm_id', 'bigint UNSIGNED NULL COMMENT "VM ID associated with the volume usage"');

server/src/test/java/com/cloud/vm/UserVmManagerImplTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
import com.cloud.deploy.DeployDestination;
8080
import com.cloud.deploy.DeploymentPlanner;
8181
import com.cloud.deploy.DeploymentPlanningManager;
82+
import com.cloud.event.UsageEventUtils;
8283
import com.cloud.exception.InsufficientAddressCapacityException;
8384
import com.cloud.exception.InsufficientCapacityException;
8485
import com.cloud.exception.InsufficientServerCapacityException;
@@ -385,6 +386,7 @@ public class UserVmManagerImplTest {
385386
private DiskOfferingVO largerDisdkOffering = prepareDiskOffering(10l * GiB_TO_BYTES, 2l, 10L, 20L);
386387
Class<InvalidParameterValueException> expectedInvalidParameterValueException = InvalidParameterValueException.class;
387388
Class<CloudRuntimeException> expectedCloudRuntimeException = CloudRuntimeException.class;
389+
private MockedStatic<UsageEventUtils> usageEventUtilsMocked;
388390

389391
@Before
390392
public void beforeTest() {
@@ -408,11 +410,13 @@ public void beforeTest() {
408410
lenient().doNothing().when(resourceLimitMgr).decrementResourceCount(anyLong(), any(Resource.ResourceType.class), anyLong());
409411

410412
Mockito.when(virtualMachineProfile.getId()).thenReturn(vmId);
413+
usageEventUtilsMocked = Mockito.mockStatic(UsageEventUtils.class);
411414
}
412415

413416
@After
414417
public void afterTest() {
415418
CallContext.unregister();
419+
usageEventUtilsMocked.close();
416420
}
417421

418422
@Test

0 commit comments

Comments
 (0)