From 09ca5c76557a5fd37519688dc7fc385314839152 Mon Sep 17 00:00:00 2001 From: balasukesh Date: Fri, 6 Oct 2023 22:13:37 -0500 Subject: [PATCH 1/2] Fix flaky tests in LogMessageTest --- .../hippo4j/common/toolkit/logtracing/LogMessageTest.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/infra/common/src/test/java/cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java b/infra/common/src/test/java/cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java index 5750f58701..b9d55ea8db 100644 --- a/infra/common/src/test/java/cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java +++ b/infra/common/src/test/java/cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java @@ -73,7 +73,8 @@ public void testKvShouldPutKeyAndValue() { public void testKvShouldPutAllKeyAndValuePairs() { logMessage.kv("key1", "value1"); logMessage.kv("key2", "value2"); - assertEquals("key1=value1||key2=value2", logMessage.toString()); + String output = logMessage.toString(); + assertTrue(output.equals("key1=value1||key2=value2") || output.equals("key2=value2||key1=value1")); } @Test @@ -81,7 +82,8 @@ public void testToStringShouldPrintMessageAndAllKeyAndValuePairs() { logMessage.setMsg(MESSAGE); logMessage.kv("key1", "value1"); logMessage.kv("key2", "value2"); - assertEquals("messagekey1=value1||key2=value2", logMessage.toString()); + String output = logMessage.toString(); + assertTrue(output.equals("messagekey1=value1||key2=value2") || output.equals("messagekey2=value2||key1=value1")); } @Test From 5a743d986b7b5ca6224b81bb8a7f654341465981 Mon Sep 17 00:00:00 2001 From: balasukesh Date: Wed, 11 Oct 2023 17:32:12 -0500 Subject: [PATCH 2/2] Remove fix for NOD test --- .../cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/infra/common/src/test/java/cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java b/infra/common/src/test/java/cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java index b9d55ea8db..7909caf952 100644 --- a/infra/common/src/test/java/cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java +++ b/infra/common/src/test/java/cn/hippo4j/common/toolkit/logtracing/LogMessageTest.java @@ -82,8 +82,7 @@ public void testToStringShouldPrintMessageAndAllKeyAndValuePairs() { logMessage.setMsg(MESSAGE); logMessage.kv("key1", "value1"); logMessage.kv("key2", "value2"); - String output = logMessage.toString(); - assertTrue(output.equals("messagekey1=value1||key2=value2") || output.equals("messagekey2=value2||key1=value1")); + assertEquals("messagekey1=value1||key2=value2", logMessage.toString()); } @Test