Skip to content

Commit

Permalink
Update exception messages to match changes
Browse files Browse the repository at this point in the history
  • Loading branch information
williamrandolph committed Nov 15, 2023
1 parent ceb9dce commit 7d8bde5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public void testFailsToStartIfDowngraded() {
);
assertThat(
illegalStateException.getMessage(),
allOf(startsWith("cannot downgrade a node from version ["), endsWith("] to version [" + Build.current().version() + "]"))
allOf(startsWith("cannot downgrade a node using index version ["), endsWith("] to version [" + Build.current().version() + "]"))
);
}

Expand All @@ -137,7 +137,7 @@ public void testFailsToStartIfUpgradedTooFar() {
assertThat(
illegalStateException.getMessage(),
allOf(
startsWith("cannot upgrade a node from version ["),
startsWith("cannot upgrade a node using index version ["),
endsWith(
"] directly to version ["
+ Build.current().version()
Expand Down
6 changes: 2 additions & 4 deletions server/src/main/java/org/elasticsearch/env/NodeMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,8 @@ public void verifyUpgradeToCurrentVersion() {
: "version is required in the node metadata from v9 onwards";

if (nodeIndexVersion.before(IndexVersions.MINIMUM_IN_PLACE_UPGRADE_COMPATIBLE)) {
// TODO[wrb]: fix message
throw new IllegalStateException(
"cannot upgrade a node from version ["
"cannot upgrade a node using index version ["
+ nodeIndexVersion
+ "] directly to version ["
+ Build.current().version()
Expand All @@ -130,9 +129,8 @@ public void verifyUpgradeToCurrentVersion() {
}

if (nodeIndexVersion.after(IndexVersion.current())) {
// TODO[wrb]: fix message
throw new IllegalStateException(
"cannot downgrade a node from version [" + nodeIndexVersion + "] to version [" + Build.current().version() + "]"
"cannot downgrade a node using index version [" + nodeIndexVersion + "] to version [" + Build.current().version() + "]"
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ public void testIndexCompatibilityChecks() throws IOException {
assertThat(
ex.getMessage(),
allOf(
startsWith("cannot upgrade a node from version [" + oldVersion.id() + "] directly"),
startsWith("cannot upgrade a node using index version [" + oldVersion.id() + "] directly"),
containsString("upgrade to version [" + Build.current().minWireCompatVersion())
)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void testUpgradesMissingVersion() {
assertThat(
illegalStateException.getMessage(),
startsWith(
"cannot upgrade a node from version [" + IndexVersions.ZERO + "] directly to version [" + Build.current().version() + "]"
"cannot upgrade a node using index version [" + IndexVersions.ZERO + "] directly to version [" + Build.current().version() + "]"
)
);
}
Expand All @@ -126,7 +126,7 @@ public void testDoesNotUpgradeFutureVersion() {
);
assertThat(
illegalStateException.getMessage(),
allOf(startsWith("cannot downgrade a node from version ["), endsWith("] to version [" + Build.current().version() + "]"))
allOf(startsWith("cannot downgrade a node using index version ["), endsWith("] to version [" + Build.current().version() + "]"))
);
}

Expand All @@ -138,7 +138,7 @@ public void testDoesNotUpgradeAncientVersion() {
assertThat(
illegalStateException.getMessage(),
allOf(
startsWith("cannot upgrade a node from version ["),
startsWith("cannot upgrade a node using index version ["),
endsWith(
"] directly to version ["
+ Build.current().version()
Expand Down

0 comments on commit 7d8bde5

Please sign in to comment.