Skip to content

Commit

Permalink
attempt to fix failing test by replacing sleep with awaiting condition
Browse files Browse the repository at this point in the history
  • Loading branch information
micossow committed Apr 10, 2024
1 parent eda7e9f commit 6623445
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ abstract class MessageMoveTaskTest
testClient.startMessageMoveTask(DlqArn, maxNumberOfMessagesPerSecond = Some(1))

// then: ensure that not all messages were moved back to the original queue after 2 seconds
Thread.sleep(2000)
fetchApproximateNumberOfMessages(queue) should (be > 1 and be < 6)
fetchApproximateNumberOfMessages(dlq) should (be > 1 and be < 6)
eventually(timeout(5.seconds), interval(100.millis)) {
fetchApproximateNumberOfMessages(queue) should (be > 1 and be < 6)
fetchApproximateNumberOfMessages(dlq) should (be > 1 and be < 6)
}
}

test("should not run two message move tasks in parallel") {
Expand All @@ -67,9 +68,10 @@ abstract class MessageMoveTaskTest
)

// and: ensure that not all messages were moved back to the original queue after 2 seconds
Thread.sleep(2000)
fetchApproximateNumberOfMessages(queue) should (be > 1 and be < 6)
fetchApproximateNumberOfMessages(dlq) should (be > 1 and be < 6)
eventually(timeout(5.seconds), interval(100.millis)) {
fetchApproximateNumberOfMessages(queue) should (be > 1 and be < 6)
fetchApproximateNumberOfMessages(dlq) should (be > 1 and be < 6)
}
}

test("should run message move task and list it") {
Expand Down

0 comments on commit 6623445

Please sign in to comment.