Add hook to execute logic before Integ test task starts (#1969)

Signed-off-by: Ankit Kala <ankikala@amazon.com>
This commit is contained in:
ankitkala 2022-01-25 14:47:45 +05:30 committed by GitHub
parent 3ce377f5cc
commit 56ae7fab63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -31,6 +31,7 @@
package org.opensearch.gradle.testclusters;
import groovy.lang.Closure;
import org.opensearch.gradle.FileSystemOperationsAware;
import org.opensearch.gradle.test.Fixture;
import org.opensearch.gradle.util.GradleUtils;
@ -60,6 +61,7 @@ import java.util.List;
public class StandaloneRestIntegTestTask extends Test implements TestClustersAware, FileSystemOperationsAware {
private Collection<OpenSearchCluster> clusters = new HashSet<>();
private Closure<Void> beforeStart;
public StandaloneRestIntegTestTask() {
this.getOutputs()
@ -86,6 +88,18 @@ public class StandaloneRestIntegTestTask extends Test implements TestClustersAwa
);
}
// Hook for executing any custom logic before starting the task.
public void setBeforeStart(Closure<Void> closure) {
beforeStart = closure;
}
@Override
public void beforeStart() {
if (beforeStart != null) {
beforeStart.call(this);
}
}
@Override
public int getMaxParallelForks() {
return 1;