Skip to content

Commit

Permalink
Support for bwc tests for plugins (#1051)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
VachaShah committed Aug 14, 2021
1 parent f151bff commit 04ba469
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ public void plugin(String pluginProjectPath) {
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));
Expand Down Expand Up @@ -387,20 +392,27 @@ public void goToNextVersion() {
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();
}

Expand Down Expand Up @@ -435,6 +447,18 @@ private void writeUnicastHostsFiles() {
});
}

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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,14 @@ public void plugin(Provider<RegularFile> plugin) {
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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 04ba469

Please sign in to comment.