Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport-1.x] Support for bwc tests for plugins (#1051) #1090

Merged
merged 1 commit into from
Aug 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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