@Override protected boolean matchesSafely(LoggerRule item) { synchronized (item) { for (LogRecord record : item.getRecords()) { if (level == null || record.getLevel() == level) { if (message.matches(record.getMessage())) { if (thrown != null) { if (thrown.matches(record.getThrown())) { return true; } } else { return true; } } } } } return false; }
@Override public void evaluate() throws Throwable { WorkflowJob p = story.j.jenkins.getItemByFullName("p", WorkflowJob.class); WorkflowRun b = p.getLastBuild(); SemaphoreStep.success("wait/1", null); story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b)); assertThat(logger.getRecords(), Matchers.hasSize(Matchers.equalTo(1))); assertEquals(CpsFlowExecution.TimingKind.values().length, ((CpsFlowExecution) b.getExecution()).timings.keySet().size()); } });
@Override public void evaluate() throws Throwable { WorkflowJob p = (WorkflowJob) story.j.jenkins.getItem("demo"); assertNotNull(p); WorkflowRun b = p.getLastBuild(); SemaphoreStep.success("wait/1", null); story.j.assertBuildStatusSuccess(story.j.waitForCompletion(b)); story.j.assertLogContains("before=demo", b); story.j.assertLogContains("ONAGENT=true", b); story.j.assertLogContains("reallyAfterFoo", b); story.j.assertLogNotContains("neverShouldReach", b); FlowExecution execution = b.getExecution(); assertNotNull(execution); FlowGraphWalker walker = new FlowGraphWalker(execution); List<WorkspaceAction> actions = new ArrayList<>(); for (FlowNode n : walker) { WorkspaceAction a = n.getAction(WorkspaceAction.class); if (a != null) { actions.add(a); } } assertEquals(1, actions.size()); assertEquals(new HashSet<>(Arrays.asList(LabelAtom.get("remote"), LabelAtom.get("quick"))), actions.get(0).getLabels()); assertThat(logger.getRecords(), Matchers.hasSize(Matchers.equalTo(0))); } });
endExit.release(); assertThat(logging.getRecords(), empty());