Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove flaky assertion from FlowDurabilityTest.verifyExecutionRemoved #784

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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