Fix test breakages on Gerrit master Avoid using the JUnit method name which is now ending with the '[default]' suffix added to all tests after the merging of I92c2f633 into Gerrit master branch. Using System.nanoTime() provides the same results of having different cache names and is more resilient against future changes on the Gerrit test infrastructure. Also remove the assumption on the actual cache initial stats that could vary between Gerrit releases, as they did as a indirect consequence of I70c3b0a708d. Change-Id: I071cdcec5b1224974ce638fad58cba244fc31e2c
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AnalyzeH2CachesIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AnalyzeH2CachesIT.java index 7c55849..7ac52f3 100644 --- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AnalyzeH2CachesIT.java +++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AnalyzeH2CachesIT.java
@@ -47,11 +47,11 @@ String result = adminSshSession.exec(cmd); adminSshSession.assertSuccess(); - assertThat(result).contains("[cache \"git_file_diff\"]\n" + "\tmaxEntries = 1\n"); - assertThat(result).contains("[cache \"gerrit_file_diff\"]\n" + "\tmaxEntries = 2\n"); - assertThat(result).contains("[cache \"accounts\"]\n" + "\tmaxEntries = 4\n"); - assertThat(result).contains("[cache \"diff_summary\"]\n" + "\tmaxEntries = 1\n"); - assertThat(result).contains("[cache \"persisted_projects\"]\n" + "\tmaxEntries = 3\n"); + assertThat(result).contains("[cache \"git_file_diff\"]"); + assertThat(result).contains("[cache \"gerrit_file_diff\"]"); + assertThat(result).contains("[cache \"accounts\"]"); + assertThat(result).contains("[cache \"diff_summary\"]"); + assertThat(result).contains("[cache \"persisted_projects\"]"); } @Test
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheExtendedIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheExtendedIT.java index 6fec793..4735477 100644 --- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheExtendedIT.java +++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/ChronicleMapCacheExtendedIT.java
@@ -77,7 +77,7 @@ @Override protected void beforeTest(Description description) throws Exception { super.beforeTest(description); - testCacheName += description.getMethodName(); + testCacheName += System.nanoTime(); } @Test