Skip to content

Commit

Permalink
[core] assure commutativity of State in case of ERROR state
Browse files Browse the repository at this point in the history
  • Loading branch information
knopers8 committed Mar 21, 2024
1 parent cf35135 commit 1b9b1cd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/task/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (s State) X(other State) State {
if s == other {
return s
}
if s == ERROR {
if s == ERROR || other == ERROR {
return ERROR
}
if s != other {
Expand Down
4 changes: 2 additions & 2 deletions core/task/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ var _ = Describe("task state", func() {
Expect(task.ERROR.X(task.RUNNING)).To(Equal(task.ERROR))
Expect(task.ERROR.X(task.INVARIANT)).To(Equal(task.ERROR))

Expect(task.UNKNOWN.X(task.ERROR)).To(Equal(task.ERROR)) // FIXME: this fails
Expect(task.RUNNING.X(task.ERROR)).To(Equal(task.ERROR)) // FIXME: this fails
Expect(task.UNKNOWN.X(task.ERROR)).To(Equal(task.ERROR))
Expect(task.RUNNING.X(task.ERROR)).To(Equal(task.ERROR))
Expect(task.INVARIANT.X(task.ERROR)).To(Equal(task.ERROR))
})
})
Expand Down

0 comments on commit 1b9b1cd

Please sign in to comment.