diff options
author | Jon Marius Venstad <venstad@gmail.com> | 2021-01-14 10:55:23 +0100 |
---|---|---|
committer | Jon Marius Venstad <venstad@gmail.com> | 2021-01-14 10:55:23 +0100 |
commit | b0b1736459aedca891d0ddb355e922d5e5c2c299 (patch) | |
tree | edca6a3d93b741b594398f9bcd3860ae4e9b54fa /configserver/src/test/java | |
parent | f0dda9a306ecb000be56512732c620f5d7c5b3f1 (diff) |
Let maintainer remove data for no-longer-existent types
Diffstat (limited to 'configserver/src/test/java')
-rw-r--r-- | configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java index d75b91f45e3..d0a4cd59dbd 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/maintenance/ReindexingMaintainerTest.java @@ -5,8 +5,11 @@ import com.yahoo.vespa.config.server.application.ApplicationReindexing; import org.junit.Test; import java.time.Instant; +import java.util.List; +import java.util.Map; import static com.yahoo.vespa.config.server.maintenance.ReindexingMaintainer.withNewReady; +import static com.yahoo.vespa.config.server.maintenance.ReindexingMaintainer.withOnlyCurrentData; import static org.junit.Assert.assertEquals; /** @@ -46,4 +49,34 @@ public class ReindexingMaintainerTest { later); } + @Test + public void testGarbageRemoval() { + ApplicationReindexing reindexing = ApplicationReindexing.ready(Instant.EPOCH) + .withPending("one", "a", 10) + .withPending("two", "b", 20) + .withReady("one", "a", Instant.ofEpochMilli(3)) + .withReady("two", "b", Instant.ofEpochMilli(2)) + .withReady("two", "c", Instant.ofEpochMilli(3)); + + assertEquals(reindexing, + withOnlyCurrentData(reindexing, Map.of("one", List.of("a", "b", "c", "d"), + "two", List.of("b", "c"), + "three", List.of("a", "b")))); + + assertEquals(reindexing, + withOnlyCurrentData(reindexing, Map.of("one", List.of("a"), + "two", List.of("b", "c")))); + + assertEquals(ApplicationReindexing.ready(Instant.EPOCH) + .withPending("two", "b", 20) + .withReady("two", "b", Instant.ofEpochMilli(2)), + withOnlyCurrentData(reindexing, Map.of("two", List.of("a", "b")))); + + assertEquals(ApplicationReindexing.ready(Instant.EPOCH) + .withReady("one", Instant.EPOCH) + .withReady("two", "c", Instant.ofEpochMilli(3)), + withOnlyCurrentData(reindexing, Map.of("one", List.of("c"), + "two", List.of("c")))); + } + } |