Support for bwc tests for plugins (#1051)

* Support for bwc tests for plugins

Signed-off-by: Vacha <vachshah@amazon.com>

* Adding support for restart upgrades for plugins bwc

Signed-off-by: Vacha <vachshah@amazon.com>
This commit is contained in:
Vacha 2021-08-12 13:28:08 -07:00 committed by GitHub
parent af6fbc77eb
commit 072ccda932
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 8 deletions

View File

@ -186,6 +186,11 @@ public class OpenSearchCluster implements TestClusterConfiguration, Named {
nodes.all(each -> each.plugin(pluginProjectPath));
}
@Override
public void upgradePlugin(List<Provider<RegularFile>> plugins) {
nodes.all(each -> each.upgradePlugin(plugins));
}
@Override
public void module(Provider<RegularFile> module) {
nodes.all(each -> each.module(module));
@ -387,20 +392,27 @@ public class OpenSearchCluster implements TestClusterConfiguration, Named {
writeUnicastHostsFiles();
}
public void upgradeAllNodesAndPluginsToNextVersion(List<Provider<RegularFile>> plugins) {
stop(false);
nodes.all(OpenSearchNode::goToNextVersion);
upgradePlugin(plugins);
start();
writeUnicastHostsFiles();
}
public void fullRestart() {
stop(false);
start();
}
public void nextNodeToNextVersion() {
if (nodeIndex + 1 > nodes.size()) {
throw new TestClustersException("Ran out of nodes to take to the next version");
}
OpenSearchNode node = nodes.getByName(clusterName + "-" + nodeIndex);
node.stop(false);
node.goToNextVersion();
commonNodeConfig(node, null, null);
nodeIndex += 1;
OpenSearchNode node = upgradeNodeToNextVersion();
node.start();
}
public void upgradeNodeAndPluginToNextVersion(List<Provider<RegularFile>> plugins) {
OpenSearchNode node = upgradeNodeToNextVersion();
node.upgradePlugin(plugins);
node.start();
}
@ -435,6 +447,18 @@ public class OpenSearchCluster implements TestClusterConfiguration, Named {
});
}
private OpenSearchNode upgradeNodeToNextVersion() {
if (nodeIndex + 1 > nodes.size()) {
throw new TestClustersException("Ran out of nodes to take to the next version");
}
OpenSearchNode node = nodes.getByName(clusterName + "-" + nodeIndex);
node.stop(false);
node.goToNextVersion();
commonNodeConfig(node, null, null);
nodeIndex += 1;
return node;
}
@Override
@Internal
public String getHttpSocketURI() {

View File

@ -408,6 +408,14 @@ public class OpenSearchNode implements TestClusterConfiguration {
this.plugins.add(plugin.map(RegularFile::getAsFile));
}
@Override
public void upgradePlugin(List<Provider<RegularFile>> plugins) {
this.plugins.clear();
for (Provider<RegularFile> plugin : plugins) {
this.plugins.add(plugin.map(RegularFile::getAsFile));
}
}
@Override
public void plugin(String pluginProjectPath) {
plugin(maybeCreatePluginOrModuleDependency(pluginProjectPath));

View File

@ -59,6 +59,8 @@ public interface TestClusterConfiguration {
void plugin(String pluginProjectPath);
void upgradePlugin(List<Provider<RegularFile>> plugins);
void module(Provider<RegularFile> module);
void module(String moduleProjectPath);