Skip to content

Commit

Permalink
chore: remove erroneous shutdown unit test
Browse files Browse the repository at this point in the history
Removes the `shutdown` unit test from `TransactionalOutboxImplSpec`:
- It does not make sense, i.e. there are two items (which also
  happen to be the exact same instance) queued for processing, but
  then only one of them is reset to pending.
- There is a separate suite `OutboxShutdownSpec` that provides a range
  of unit tests specifically for the `shutdown` method and covers all
  possible paths.

[SW-587]
  • Loading branch information
panos-tr committed Jul 17, 2024
1 parent ea6b665 commit 93fb949
Showing 1 changed file with 0 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,49 +98,6 @@ class TransactionalOutboxImplSpec extends Specification {
0 * _
}

def "Should delegate to the outbox store when shutdown is called and there are tasks that didn't start execution"() {
given:
def pendingItem = OutboxItemBuilder.make().withType(type).build()
def items = [pendingItem, pendingItem]
def now = Instant.now(clock)

when:
transactionalOutbox.monitor()

then:
1 * monitorLocksProvider.acquire()
1 * store.fetch(_) >> { OutboxFilter filter ->
with(filter) {
outboxPendingFilter.nextRunLessThan == now
}
items
}
items.size() * store.update(_) >> { OutboxItem item ->
with(item) {
it.status == OutboxStatus.RUNNING
it.lastExecution == now
it.rerunAfter == item.lastExecution + DURATION_ONE_HOUR
}
return item
}
1 * monitorLocksProvider.release()
0 * _

when:
transactionalOutbox.shutdown()

then:
1 * store.update(_) >> { OutboxItem item ->
with(item) {
it.status == OutboxStatus.PENDING
it.nextRun == now
it.rerunAfter == null
}
return item
}
0 * _
}

def "Should delegate to outbox store when `cleanup` is invoked"() {
given:
def now = Instant.now(clock)
Expand Down

0 comments on commit 93fb949

Please sign in to comment.