From 9a95659a9aee22b3e60bcd1fa64984d4a39a2168 Mon Sep 17 00:00:00 2001 From: Armin Date: Mon, 25 Mar 2019 19:41:25 +0100 Subject: [PATCH] Use Correct Enum in Wipe Snapshots Test Method * Mistake was made in #39662 * The response deserialized here is `org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsResponse` which uses `org.elasticsearch.snapshots.SnapshotInfo` which uses `org.elasticsearch.snapshots.SnapshotState` and not the shard state --- .../main/java/org/elasticsearch/test/rest/ESRestTestCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index 187393e8c9e96..87596beb451d1 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -36,7 +36,6 @@ import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestClientBuilder; import org.elasticsearch.client.WarningsHandler; -import org.elasticsearch.cluster.SnapshotsInProgress; import org.elasticsearch.common.CheckedRunnable; import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.PathUtils; @@ -53,6 +52,7 @@ import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.core.internal.io.IOUtils; import org.elasticsearch.rest.RestStatus; +import org.elasticsearch.snapshots.SnapshotState; import org.elasticsearch.test.ESTestCase; import org.junit.After; import org.junit.AfterClass; @@ -544,7 +544,7 @@ private void wipeCluster() throws Exception { for (Object snapshot : snapshots) { Map snapshotInfo = (Map) snapshot; String name = (String) snapshotInfo.get("snapshot"); - if (SnapshotsInProgress.State.valueOf((String) snapshotInfo.get("state")).completed() == false) { + if (SnapshotState.valueOf((String) snapshotInfo.get("state")).completed() == false) { inProgressSnapshots.computeIfAbsent(repoName, key -> new ArrayList<>()).add(snapshotInfo); } logger.debug("wiping snapshot [{}/{}]", repoName, name);