use of pipelite.stage.parameters.CmdExecutorParameters in project pipelite by enasequence.
the class SingleStageCmdTestProcessConfiguration method configure.
@Override
protected void configure(ProcessBuilder builder) {
CmdExecutorParameters.CmdExecutorParametersBuilder<?, ?> executorParamsBuilder = CmdExecutorParameters.builder();
executorParamsBuilder.maximumRetries(maximumRetries()).immediateRetries(immediateRetries());
CmdExecutorParameters executorParams = executorParamsBuilder.build();
executorParams.setPermanentErrors(testType().permanentErrors());
builder.execute(stageName()).withCmdExecutor(testType().nextCmd(pipelineName(), builder.getProcessId(), stageName()), executorParams);
}
use of pipelite.stage.parameters.CmdExecutorParameters in project pipelite by enasequence.
the class LocalCmdExecutorTest method test.
@Test
public void test() {
String stageName = PipeliteIdCreator.stageName();
CmdExecutor<CmdExecutorParameters> executor = StageExecutor.createCmdExecutor("echo test");
executor.setExecutorParams(CmdExecutorParameters.builder().build());
Stage stage = Stage.builder().stageName(stageName).executor(executor).build();
stage.execute(PIPELINE_NAME, PROCESS_ID, (result) -> {
assertThat(result.isSuccess()).isTrue();
assertThat(result.getAttribute(StageExecutorResultAttribute.COMMAND)).isEqualTo("echo test");
assertThat(result.getAttribute(StageExecutorResultAttribute.EXIT_CODE)).isEqualTo("0");
assertThat(result.getStageLog()).contains("test\n");
});
}
use of pipelite.stage.parameters.CmdExecutorParameters in project pipelite by enasequence.
the class SshCmdExecutorTest method test.
@Test
@EnabledIfEnvironmentVariable(named = "PIPELITE_TEST_SSH_HOST", matches = ".+")
public void test() {
String stageName = PipeliteIdCreator.stageName();
CmdExecutor<CmdExecutorParameters> executor = StageExecutor.createCmdExecutor("echo test");
executor.setExecutorParams(CmdExecutorParameters.builder().host(sshTestConfiguration.getHost()).user(sshTestConfiguration.getUser()).timeout(Duration.ofSeconds(30)).build());
Stage stage = Stage.builder().stageName(stageName).executor(executor).build();
stage.execute(PIPELINE_NAME, PROCESS_ID, (result) -> {
// Ignore timeout errors.
if (result.isErrorType(ErrorType.TIMEOUT_ERROR)) {
return;
}
assertThat(result.isSuccess()).isTrue();
assertThat(result.getAttribute(StageExecutorResultAttribute.COMMAND)).isEqualTo("echo test");
assertThat(result.getAttribute(StageExecutorResultAttribute.EXIT_CODE)).isEqualTo("0");
assertThat(result.getStageLog()).contains("test\n");
});
}
Aggregations