Skip to content

Commit d82da38

Browse files
test: cover static IP preservation from a bare Tools address list without prefix
1 parent 2287102 commit d82da38

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

server/src/test/java/org/apache/cloudstack/vm/UnmanagedVMsManagerImplTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,4 +1976,15 @@ public void testAutoFillSkipsGatewayAndInUseIps() {
19761976
Assert.assertFalse(result.containsKey("Network adapter 2"));
19771977
Mockito.verify(network, Mockito.atLeastOnce()).getCidr();
19781978
}
1979+
1980+
@Test
1981+
public void testAutoFillAcceptsBareAddressWithoutPrefix() {
1982+
// Older or limited VMware Tools report addresses without ipConfig, so the captured
1983+
// entry has no prefix - preservation must still work from the bare address.
1984+
staticIpTestNetwork(200L, "10.1.1.0/24", "10.1.1.1");
1985+
Map<String, com.cloud.network.Network.IpAddresses> result = unmanagedVMsManager.autoFillStaticNicIpAddresses(
1986+
Map.of("Network adapter 1", 200L), null,
1987+
Map.of("Network adapter 1", java.util.List.of("10.1.1.151")));
1988+
Assert.assertEquals("10.1.1.151", result.get("Network adapter 1").getIp4Address());
1989+
}
19791990
}

0 commit comments

Comments
 (0)