@Test(expected = IllegalArgumentException.class) public void test_that_calculateLifetime_throws_an_error_if_lifetime_and_start_and_endtime_not_provided() { Instant now = Instant.now(); stage.calculateLifetime(now, null, CanaryAnalysisExecutionRequest.builder().build()); }
protected Duration calculateLifetime( Instant start, Instant endTime, CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest) { Duration lifetime; if (endTime != null) { lifetime = Duration.ofMinutes(start.until(endTime, MINUTES)); } else if (canaryAnalysisExecutionRequest.getLifetimeDuration() != null) { lifetime = canaryAnalysisExecutionRequest.getLifetimeDuration(); } else { throw new IllegalArgumentException( "Canary StageExecution configuration must include either `endTime` or `lifetimeDuration`."); } return lifetime; }
SetupAndExecuteCanariesStage implements StageDefinitionBuilder { protected Duration calculateLifetime( Instant start, Instant endTime, CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest) { Duration lifetime; if (endTime != null) { lifetime = Duration.ofMinutes(start.until(endTime, MINUTES)); } else if (canaryAnalysisExecutionRequest.getLifetimeDuration() != null) { lifetime = canaryAnalysisExecutionRequest.getLifetimeDuration(); } else { throw new IllegalArgumentException( "Canary StageExecution configuration must include either `endTime` or `lifetimeDuration`."); } return lifetime; } }
SetupAndExecuteCanariesStage implements StageDefinitionBuilder { protected Duration calculateLifetime( Instant start, Instant endTime, CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest) { Duration lifetime; if (endTime != null) { lifetime = Duration.ofMinutes(start.until(endTime, MINUTES)); } else if (canaryAnalysisExecutionRequest.getLifetimeDuration() != null) { lifetime = canaryAnalysisExecutionRequest.getLifetimeDuration(); } else { throw new IllegalArgumentException( "Canary StageExecution configuration must include either `endTime` or `lifetimeDuration`."); } return lifetime; } @Autowired  SetupAndExecuteCanariesStage(Clock clock, ObjectMapper kayentaObjectMapper); }
SetupAndExecuteCanariesStage implements StageDefinitionBuilder { protected Duration calculateLifetime( Instant start, Instant endTime, CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest) { Duration lifetime; if (endTime != null) { lifetime = Duration.ofMinutes(start.until(endTime, MINUTES)); } else if (canaryAnalysisExecutionRequest.getLifetimeDuration() != null) { lifetime = canaryAnalysisExecutionRequest.getLifetimeDuration(); } else { throw new IllegalArgumentException( "Canary StageExecution configuration must include either `endTime` or `lifetimeDuration`."); } return lifetime; } @Autowired  SetupAndExecuteCanariesStage(Clock clock, ObjectMapper kayentaObjectMapper); @Override void taskGraph(@Nonnull StageExecution stage, @Nonnull TaskNode.Builder builder); @Override void beforeStages(@Nonnull StageExecution parent, @Nonnull StageGraphBuilder graph); @Override void onFailureStages(@Nonnull StageExecution parent, @Nonnull StageGraphBuilder graph); @Override void afterStages(@Nonnull StageExecution parent, @Nonnull StageGraphBuilder graph); @Nonnull @Override String getType(); }
SetupAndExecuteCanariesStage implements StageDefinitionBuilder { protected Duration calculateLifetime( Instant start, Instant endTime, CanaryAnalysisExecutionRequest canaryAnalysisExecutionRequest) { Duration lifetime; if (endTime != null) { lifetime = Duration.ofMinutes(start.until(endTime, MINUTES)); } else if (canaryAnalysisExecutionRequest.getLifetimeDuration() != null) { lifetime = canaryAnalysisExecutionRequest.getLifetimeDuration(); } else { throw new IllegalArgumentException( "Canary StageExecution configuration must include either `endTime` or `lifetimeDuration`."); } return lifetime; } @Autowired  SetupAndExecuteCanariesStage(Clock clock, ObjectMapper kayentaObjectMapper); @Override void taskGraph(@Nonnull StageExecution stage, @Nonnull TaskNode.Builder builder); @Override void beforeStages(@Nonnull StageExecution parent, @Nonnull StageGraphBuilder graph); @Override void onFailureStages(@Nonnull StageExecution parent, @Nonnull StageGraphBuilder graph); @Override void afterStages(@Nonnull StageExecution parent, @Nonnull StageGraphBuilder graph); @Nonnull @Override String getType(); static final String STAGE_TYPE; static final String STAGE_DESCRIPTION; }