Skip to content

Commit 6017bc7

Browse files
committed
Reset the detachedVersion flag on upgrading cluster
This is needed so that the cluster is upgraded to the actual specified version and not keep using the same detached version as before. It has a limitation of not being able to upgrade to the detached version, but there is no such test case currently.
1 parent 7e8ba7a commit 6017bc7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/DefaultLocalClusterHandle.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,15 @@ public void upgradeNodeToVersion(int index, Version version) {
167167
Node node = nodes.get(index);
168168
node.stop(false);
169169
LOGGER.info("Upgrading node '{}' to version {}", node.getName(), version);
170+
node.getSpec().setDetachedVersion(false);
170171
node.start(version);
171172
waitUntilReady();
172173
}
173174

174175
@Override
175176
public void upgradeToVersion(Version version) {
176177
stop(false);
178+
nodes.forEach(node -> node.getSpec().setDetachedVersion(false));
177179
if (started.getAndSet(true) == false) {
178180
LOGGER.info("Upgrading Elasticsearch test cluster '{}' to version {}", name, version);
179181
execute(() -> nodes.parallelStream().forEach(n -> n.start(version)));

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/LocalClusterSpec.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static class LocalNodeSpec {
106106
private final List<String> jvmArgs;
107107
private final Path configDir;
108108
private Version version;
109-
private final boolean detachedVersion;
109+
private boolean detachedVersion;
110110

111111
public LocalNodeSpec(
112112
LocalClusterSpec cluster,
@@ -179,6 +179,10 @@ public boolean isDetachedVersion() {
179179
return detachedVersion;
180180
}
181181

182+
public void setDetachedVersion(boolean detachedVersion) {
183+
this.detachedVersion = detachedVersion;
184+
}
185+
182186
public List<User> getUsers() {
183187
return cluster.getUsers();
184188
}

0 commit comments

Comments
 (0)