Skip to content

Commit

Permalink
Disable FQDN test on misconfigured hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
ppkarwasz committed Sep 3, 2024
1 parent 5250a47 commit 0e22358
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
package org.apache.logging.log4j.core.util;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assumptions.assumeThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

import java.io.File;
import java.net.InetAddress;
import java.net.URI;
import java.net.UnknownHostException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
Expand Down Expand Up @@ -73,7 +76,8 @@ public void testToUriWindowsAbsolutePath() {
}

@Test
public void testCanonicalHostName() {
public void testCanonicalHostName() throws UnknownHostException {
assumeThat(InetAddress.getLocalHost().getCanonicalHostName()).contains(".");
// If this fails the host might be misconfigured
assertThat(NetUtils.getCanonicalLocalHostname()).contains(".");
}
Expand Down

0 comments on commit 0e22358

Please sign in to comment.