Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WFCORE-6962] Add another check that candidates exist #6217

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class OverallInterfaceCriteriaUnitTestCase {
@Test
public void testBasic() throws Exception {

Assume.assumeFalse(allCandidates.size() < 1);
Assume.assumeFalse(allCandidates.isEmpty());

Map.Entry<NetworkInterface, Set<InetAddress>> correct = allCandidates.entrySet().iterator().next();

Expand All @@ -60,7 +60,7 @@ public void testBasic() throws Exception {
@Test
public void testMultipleCriteria() throws Exception {

Assume.assumeFalse(nonLoopBackInterfaces.size() < 1 || loopbackInterfaces.size() < 1);
Assume.assumeFalse(nonLoopBackInterfaces.isEmpty() || loopbackInterfaces.isEmpty());

Map<NetworkInterface, Set<InetAddress>> correct = new HashMap<NetworkInterface, Set<InetAddress>>();
for (NetworkInterface ni : loopbackInterfaces) {
Expand All @@ -69,7 +69,7 @@ public void testMultipleCriteria() throws Exception {
}
}

Assume.assumeFalse(correct.size() == 0);
Assume.assumeFalse(correct.isEmpty());

Set<InterfaceCriteria> criterias = new HashSet<InterfaceCriteria>();
criterias.add(UpInterfaceCriteria.INSTANCE);
Expand All @@ -89,11 +89,11 @@ public void testMultipleCriteria() throws Exception {
@Test
public void testMultipleMatches() throws Exception {

Assume.assumeFalse(allCandidates.size() < 1);
Assume.assumeFalse(allCandidates.isEmpty());

Map<NetworkInterface, Set<InetAddress>> correct = new HashMap<NetworkInterface, Set<InetAddress>>();
for (NetworkInterface ni : allInterfaces) {
if (ni.isUp()) {
if (ni.isUp() && allCandidates.containsKey(ni)) {
correct.put(ni, getRightTypeAddresses(allCandidates.get(ni)));
}
}
Expand All @@ -115,7 +115,7 @@ public void testMultipleMatches() throws Exception {
@Test
public void testNoMatch() throws Exception {

Assume.assumeFalse(loopbackInterfaces.size() < 1);
Assume.assumeFalse(loopbackInterfaces.isEmpty());

for (NetworkInterface nic : allCandidates.keySet()) {
Assume.assumeFalse("bogus".equals(nic.getName()));
Expand All @@ -134,8 +134,8 @@ public void testNoMatch() throws Exception {
/** WFCORE-2626 */
@Test
public void testInetAddressDuplicates() throws Exception {
Assume.assumeFalse(loopbackInterfaces.size() < 1);
Assume.assumeFalse(nonLoopBackInterfaces.size() < 1);
Assume.assumeFalse(loopbackInterfaces.isEmpty());
Assume.assumeFalse(nonLoopBackInterfaces.isEmpty());

// Build up a fake candidate set where the same addresses appear associated with 2 NICs, one up, one down
// This simulates an environment with multiple NICs with the same address configured
Expand All @@ -150,7 +150,7 @@ public void testInetAddressDuplicates() throws Exception {
down = nic;
} else if (addresses == null && nic.isUp()) {
Set<InetAddress> nicAddresses = allCandidates.get(nic);
if (nicAddresses.size() > 0) {
if (!nicAddresses.isEmpty()) {
addresses = nicAddresses;
up = nic;
}
Expand Down
Loading