Skip to content

Commit

Permalink
Add hook to execute logic before Integ test task starts
Browse files Browse the repository at this point in the history
Signed-off-by: Ankit Kala <ankikala@amazon.com>
  • Loading branch information
ankitkala committed Jan 25, 2022
1 parent 3ce377f commit 5896c8e
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -60,6 +61,7 @@
public class StandaloneRestIntegTestTask extends Test implements TestClustersAware, FileSystemOperationsAware {

private Collection<OpenSearchCluster> clusters = new HashSet<>();
private Closure<Void> beforeStart;

public StandaloneRestIntegTestTask() {
this.getOutputs()
Expand All @@ -86,6 +88,18 @@ public StandaloneRestIntegTestTask() {
);
}

// 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;
Expand Down

0 comments on commit 5896c8e

Please sign in to comment.