You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pe...@apache.org on 2024/02/06 17:41:10 UTC
(cloudstack) 06/17: Fix unit test
This is an automated email from the ASF dual-hosted git repository.
pearl11594 pushed a commit to branch fr03-nsx-reorder-acl-rules
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
commit b0989f670d42e3b9dc48b83aac42f2d69a771b95
Author: nvazquez <ni...@gmail.com>
AuthorDate: Mon Jan 29 13:36:39 2024 -0300
Fix unit test
---
.../java/org/apache/cloudstack/service/NsxGuestNetworkGuruTest.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/plugins/network-elements/nsx/src/test/java/org/apache/cloudstack/service/NsxGuestNetworkGuruTest.java b/plugins/network-elements/nsx/src/test/java/org/apache/cloudstack/service/NsxGuestNetworkGuruTest.java
index e6efc8f0503..66b9684203b 100644
--- a/plugins/network-elements/nsx/src/test/java/org/apache/cloudstack/service/NsxGuestNetworkGuruTest.java
+++ b/plugins/network-elements/nsx/src/test/java/org/apache/cloudstack/service/NsxGuestNetworkGuruTest.java
@@ -37,6 +37,7 @@ import com.cloud.network.guru.GuestNetworkGuru;
import com.cloud.network.vpc.VpcVO;
import com.cloud.network.vpc.dao.VpcDao;
import com.cloud.offering.NetworkOffering;
+import com.cloud.offerings.NetworkOfferingVO;
import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.offerings.dao.NetworkOfferingServiceMapDao;
import com.cloud.user.Account;
@@ -307,6 +308,7 @@ public class NsxGuestNetworkGuruTest {
@Test
public void testCreateNsxSegmentForIsolatedNetwork() {
NetworkVO networkVO = Mockito.mock(NetworkVO.class);
+ NetworkOfferingVO offeringVO = Mockito.mock(NetworkOfferingVO.class);
DataCenter dataCenter = Mockito.mock(DataCenter.class);
when(networkVO.getAccountId()).thenReturn(1L);
@@ -315,6 +317,9 @@ public class NsxGuestNetworkGuruTest {
anyLong())).thenReturn(new NsxAnswer(new NsxCommand(), true, ""));
when(nsxControllerUtils.sendNsxCommand(any(CreateNsxSegmentCommand.class),
anyLong())).thenReturn(new NsxAnswer(new NsxCommand(), true, ""));
+ when(networkVO.getNetworkOfferingId()).thenReturn(1L);
+ when(networkOfferingDao.findById(1L)).thenReturn(offeringVO);
+ when(offeringVO.getNsxMode()).thenReturn(NetworkOffering.NsxMode.NATTED.name());
guru.createNsxSegment(networkVO, dataCenter);
verify(nsxControllerUtils, times(1)).sendNsxCommand(any(CreateNsxTier1GatewayCommand.class),
anyLong());