You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by pk...@apache.org on 2024/09/01 21:14:30 UTC
(logging-log4j2) branch 2.x updated: Disable FQDN test on misconfigured hosts
This is an automated email from the ASF dual-hosted git repository.
pkarwasz pushed a commit to branch 2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/2.x by this push:
new 84ca9bd246 Disable FQDN test on misconfigured hosts
84ca9bd246 is described below
commit 84ca9bd246b83e5c93d59c92acbd180022e0747f
Author: Piotr P. Karwasz <pi...@karwasz.org>
AuthorDate: Sun Sep 1 23:13:34 2024 +0200
Disable FQDN test on misconfigured hosts
---
.../test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java
index b22730657c..23982560fc 100644
--- a/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java
+++ b/log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/NetUtilsTest.java
@@ -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;
@@ -73,7 +76,8 @@ public class NetUtilsTest {
}
@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(".");
}