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

Fix incorrect step result when referencing an ErrorAction #2546

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -20,21 +20,17 @@ public class NodeRunStatus {
public final BlueRun.BlueRunState state;

public NodeRunStatus(@NonNull FlowNode endNode) {
Result result = null;
ErrorAction errorAction = endNode.getError();
WarningAction warningAction = endNode.getPersistentAction(WarningAction.class);
if (errorAction != null) {
if(errorAction.getError() instanceof FlowInterruptedException) {
Result result = null;
if (errorAction.getError() instanceof FlowInterruptedException) {
result = ((FlowInterruptedException) errorAction.getError()).getResult();
}
if(result == null || result != Result.ABORTED) {
this.result = BlueRun.BlueRunResult.FAILURE;
} else {
this.result = BlueRun.BlueRunResult.ABORTED;
}
this.result = result != null ? new NodeRunStatus(result).result : BlueRun.BlueRunResult.FAILURE;
this.state = endNode.isActive() ? BlueRun.BlueRunState.RUNNING : BlueRun.BlueRunState.FINISHED;
} else if (warningAction != null) {
this.result = new NodeRunStatus(GenericStatus.fromResult(warningAction.getResult())).result;
this.result = new NodeRunStatus(warningAction.getResult()).result;
this.state = endNode.isActive() ? BlueRun.BlueRunState.RUNNING : BlueRun.BlueRunState.FINISHED;
} else if (QueueItemAction.getNodeState(endNode) == QueueItemAction.QueueState.QUEUED) {
this.result = BlueRun.BlueRunResult.UNKNOWN;
Expand Down Expand Up @@ -112,4 +108,26 @@ public NodeRunStatus(GenericStatus status){
this.state = BlueRun.BlueRunState.QUEUED;
}
}

private NodeRunStatus(Result result) {
if (result == Result.SUCCESS) {
this.result = BlueRun.BlueRunResult.SUCCESS;
this.state = BlueRun.BlueRunState.FINISHED;
} else if (result == Result.UNSTABLE) {
this.result = BlueRun.BlueRunResult.UNSTABLE;
this.state = BlueRun.BlueRunState.FINISHED;
} else if (result == Result.FAILURE) {
this.result = BlueRun.BlueRunResult.FAILURE;
this.state = BlueRun.BlueRunState.FINISHED;
} else if (result == Result.NOT_BUILT) {
this.result = BlueRun.BlueRunResult.NOT_BUILT;
this.state = BlueRun.BlueRunState.NOT_BUILT;
} else if (result == Result.ABORTED) {
this.result = BlueRun.BlueRunResult.ABORTED;
this.state = BlueRun.BlueRunState.FINISHED;
} else {
this.result = BlueRun.BlueRunResult.UNKNOWN;
this.state = BlueRun.BlueRunState.RUNNING;
}
}
}
Loading