You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2020/05/21 02:40:39 UTC

[logging-log4j2] branch release-2.x updated: Allow this test to be configured from the command line for slower or busy machines.

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch release-2.x
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/release-2.x by this push:
     new 0efb766  Allow this test to be configured from the command line for slower or busy machines.
0efb766 is described below

commit 0efb766b39d2016514f9188ae6e270d2872af521
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Wed May 20 22:40:34 2020 -0400

    Allow this test to be configured from the command line for slower or
    busy machines.
---
 .../src/test/java/org/apache/logging/log4j/core/util/InitTest.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/InitTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/InitTest.java
index 782be58..e2eb09e 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/util/InitTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/util/InitTest.java
@@ -28,6 +28,8 @@ import static org.junit.Assert.assertTrue;
  */
 public class InitTest {
 
+    private static final String KEY = InitTest.class.getSimpleName() + ".threshold";
+
     @Test
     public void initTest() {
         Timer timer = new Timer("Log4j Initialization");
@@ -36,6 +38,9 @@ public class InitTest {
         timer.stop();
         long elapsed = timer.getElapsedNanoTime();
         System.out.println(timer.toString());
-        assertTrue(String.format("Initialization time exceeded threshold; elapsed %,d nanoseconds", elapsed), elapsed < 1_000_000_000);
+        long threshold = Long.getLong(KEY, 1_000_000_000);
+        assertTrue(
+                String.format("Initialization time exceeded %s %,d; elapsed %,d nanoseconds", KEY, threshold, elapsed),
+                elapsed < threshold);
     }
 }