You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by ch...@apache.org on 2022/12/13 02:24:32 UTC
[bookkeeper] branch master updated: Issue #3701 Fixed Flaky Tests (#3702)
This is an automated email from the ASF dual-hosted git repository.
chenhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/master by this push:
new c67dfb9733 Issue #3701 Fixed Flaky Tests (#3702)
c67dfb9733 is described below
commit c67dfb973333d7a02730e472216b78b300fe27e7
Author: priyanka-28 <52...@users.noreply.github.com>
AuthorDate: Mon Dec 12 20:24:25 2022 -0600
Issue #3701 Fixed Flaky Tests (#3702)
Descriptions of the changes in this PR:
The test in org.apache.bookkeeper.slogger.SloggerTest#testMap express non-deterministic behaviour and change the order of the attributes. The fix is changing HashMap to LinkedHashMap to ensure determinism.
### Motivation
Fixing non-deterministic flaky tests.
### Changes
Changed the HashMap to LinkedHashMap in test code.
---
.../api/src/test/java/org/apache/bookkeeper/slogger/SloggerTest.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bookkeeper-slogger/api/src/test/java/org/apache/bookkeeper/slogger/SloggerTest.java b/bookkeeper-slogger/api/src/test/java/org/apache/bookkeeper/slogger/SloggerTest.java
index ffb96d81d1..32bf663d7e 100644
--- a/bookkeeper-slogger/api/src/test/java/org/apache/bookkeeper/slogger/SloggerTest.java
+++ b/bookkeeper-slogger/api/src/test/java/org/apache/bookkeeper/slogger/SloggerTest.java
@@ -26,6 +26,7 @@ import static org.hamcrest.Matchers.is;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.List;
import org.junit.Test;
@@ -80,7 +81,7 @@ public class SloggerTest {
@Test
public void testMap() throws Exception {
MockSlogger root = new MockSlogger();
- HashMap<Integer, Integer> map = new HashMap<>();
+ HashMap<Integer, Integer> map = new LinkedHashMap<>();
map.put(1, 3);
map.put(2, 4);
root.kv("map", map).info(Events.FOOBAR);