private <T extends ProgramManager> void assertProgramFailure( Map<String, String> programArgs, final ProgramManager<T> programManager) throws TimeoutException, InterruptedException, ExecutionException { final int prevNumFailures = programManager.getHistory(ProgramRunStatus.FAILED).size(); programManager.start(programArgs); // need to check that every run has failed as well as the number of failures // otherwise there is a race where start() returns before any run record is written // and this check passes because there are existing failed runs, but the new run has not failed. Tasks.waitFor(true, () -> { // verify program history just have failures, and there is one more failure than before program start List<RunRecord> history = programManager.getHistory(); for (final RunRecord runRecord : history) { if (runRecord.getStatus() != ProgramRunStatus.FAILED) { return false; } } return history.size() == prevNumFailures + 1; }, 5, TimeUnit.MINUTES, "Not all program runs have failed status. Expected all run status to be failed"); programManager.waitForStopped(10, TimeUnit.SECONDS); }
manager.start(ImmutableMap.of("new.base.path", newBasePath.getPath())); manager.waitForRun(ProgramRunStatus.COMPLETED, 30, TimeUnit.SECONDS); manager.start(ImmutableMap.of("dropAll", "true")); manager.waitForRuns(ProgramRunStatus.COMPLETED, 2, 30, TimeUnit.SECONDS);
programManager.waitForRun(ProgramRunStatus.COMPLETED, 5, TimeUnit.MINUTES); programManager.waitForRuns(ProgramRunStatus.COMPLETED, 2, 5, TimeUnit.MINUTES); programManager.waitForRuns(ProgramRunStatus.COMPLETED, 3, 5, TimeUnit.MINUTES);
countsManager.flush(); manager = manager.start(); manager.waitForRun(ProgramRunStatus.COMPLETED, 180, TimeUnit.SECONDS);
@Override public Boolean call() throws Exception { List<RunRecord> runs = programManager.getHistory(); for (RunRecord meta : runs) { if (meta.getStatus() == ProgramRunStatus.STARTING || meta.getStatus() == ProgramRunStatus.RUNNING || meta.getStatus() == ProgramRunStatus.RESUMING) { return false; } } return true; } }, 10, TimeUnit.SECONDS);