Skip to content

Commit

Permalink
Merge pull request #784 from jglick/FlowDurabilityTest.verifyExecutio…
Browse files Browse the repository at this point in the history
…nRemoved

Remove flaky assertion from `FlowDurabilityTest.verifyExecutionRemoved`
  • Loading branch information
jglick authored Sep 8, 2023
2 parents ee73dab + bbcd57f commit 8f5dcd1
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import hudson.model.Executor;
import hudson.model.Item;
import hudson.model.Result;
import hudson.util.CopyOnWriteList;
import jenkins.model.Jenkins;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.workflow.TestDurabilityHintProvider;
Expand All @@ -22,7 +21,6 @@
import org.jenkinsci.plugins.workflow.flow.FlowDurabilityHint;
import org.jenkinsci.plugins.workflow.flow.FlowExecution;
import org.jenkinsci.plugins.workflow.flow.FlowExecutionList;
import org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner;
import org.jenkinsci.plugins.workflow.graph.FlowEndNode;
import org.jenkinsci.plugins.workflow.graph.FlowNode;
import org.jenkinsci.plugins.workflow.graph.FlowStartNode;
Expand Down Expand Up @@ -206,17 +204,12 @@ private WorkflowRun createAndRunSleeperJob(Jenkins jenkins, String jobName, Flow
}

private static void verifyExecutionRemoved(WorkflowRun run) throws Exception{
// Verify we've removed all FlowExcecutionList entries
FlowExecutionList list = FlowExecutionList.get();
for (FlowExecution fe : list) {
if (fe == run.getExecution()) {
Assert.fail("Run still has an execution in the list and should be removed!");
}
}
Field f = list.getClass().getDeclaredField("runningTasks");
f.setAccessible(true);
CopyOnWriteList<FlowExecutionOwner> runningTasks = (CopyOnWriteList<FlowExecutionOwner>)(f.get(list));
Assert.assertFalse(runningTasks.contains(run.asFlowExecutionOwner()));
}

static void verifySucceededCleanly(Jenkins j, WorkflowRun run) throws Exception {
Expand Down

0 comments on commit 8f5dcd1

Please sign in to comment.