Add acceptance test for REST auto-tuning for single cache Change-Id: I90842baa17d3f98a474798673e44b9d48475433c
diff --git a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AutoAdjustCachesIT.java b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AutoAdjustCachesIT.java index 209b43e..24b60ef 100644 --- a/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AutoAdjustCachesIT.java +++ b/src/test/java/com/googlesource/gerrit/modules/cache/chroniclemap/AutoAdjustCachesIT.java
@@ -196,6 +196,19 @@ assertThat(tunedFileNamesSet(MATCH_ALL)).isNotEmpty(); } + @Test + public void shouldAllowTuningOfSingleDiffCacheOverRestForAdmin() throws Exception { + createChange(); + + RestResponse resp = adminRestSession.put(REST_CMD + "?CACHE_NAME=" + DIFF); + + resp.assertCreated(); + + assertThat(configResult(resp.getEntityContent(), null).getSubsections("cache")).isNotEmpty(); + assertThat(tunedFileNamesSet(n -> n.matches(".*" + AutoAdjustCaches.TUNED_INFIX + ".*"))) + .hasSize(1); + } + private Config configResult(String result, @Nullable String configHeader) throws ConfigInvalidException { Config configResult = new Config();