Skip to content

Commit 350e18c

Browse files
authored
Make snapshot restore release version check more lenient (#116727) (#116919)
1 parent 0f881f6 commit 350e18c

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

qa/full-cluster-restart/src/javaRestTest/java/org/elasticsearch/upgrades/FullClusterRestartIT.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
import static org.elasticsearch.transport.RemoteClusterService.REMOTE_CLUSTER_COMPRESS;
8282
import static org.elasticsearch.xcontent.XContentFactory.jsonBuilder;
8383
import static org.hamcrest.Matchers.anyOf;
84+
import static org.hamcrest.Matchers.contains;
8485
import static org.hamcrest.Matchers.containsString;
8586
import static org.hamcrest.Matchers.equalTo;
8687
import static org.hamcrest.Matchers.greaterThan;
@@ -90,6 +91,7 @@
9091
import static org.hamcrest.Matchers.is;
9192
import static org.hamcrest.Matchers.notNullValue;
9293
import static org.hamcrest.Matchers.nullValue;
94+
import static org.hamcrest.Matchers.startsWith;
9395

9496
/**
9597
* Tests to run before and after a full cluster restart. This is run twice,
@@ -1286,12 +1288,16 @@ private void checkSnapshot(String snapshotName, int count, String tookOnVersion,
12861288
assertEquals(singletonList(snapshotName), XContentMapValues.extractValue("snapshots.snapshot", snapResponse));
12871289
assertEquals(singletonList("SUCCESS"), XContentMapValues.extractValue("snapshots.state", snapResponse));
12881290
// the format can change depending on the ES node version running & this test code running
1291+
// and if there's an in-progress release that hasn't been published yet,
1292+
// which could affect the top range of the index release version
1293+
String firstReleaseVersion = tookOnIndexVersion.toReleaseVersion().split("-")[0];
12891294
assertThat(
1290-
XContentMapValues.extractValue("snapshots.version", snapResponse),
1295+
(Iterable<String>) XContentMapValues.extractValue("snapshots.version", snapResponse),
12911296
anyOf(
1292-
equalTo(List.of(tookOnVersion)),
1293-
equalTo(List.of(tookOnIndexVersion.toString())),
1294-
equalTo(List.of(tookOnIndexVersion.toReleaseVersion()))
1297+
contains(tookOnVersion),
1298+
contains(tookOnIndexVersion.toString()),
1299+
contains(firstReleaseVersion),
1300+
contains(startsWith(firstReleaseVersion + "-"))
12951301
)
12961302
);
12971303

0 commit comments

Comments
 (0)