Skip to content

Commit

Permalink
- add server response delay to force difference in pre and post-db-sc…
Browse files Browse the repository at this point in the history
…ript execution time
  • Loading branch information
Thomas Sievert committed Jun 25, 2024
1 parent 1cfa975 commit 6b20b53
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import java.sql.DriverManager
import java.time.Instant
import java.util.concurrent.TimeUnit

class SquitRequestTaskConfigurableTasksTest {
private val project = TestUtils.getResourcePath("test-project-task-config")
Expand Down Expand Up @@ -45,7 +46,11 @@ class SquitRequestTaskConfigurableTasksTest {

@Test
fun `should execute pre and post tasks in default order`() {
server.enqueue(MockResponse().setBody("<cool/>"))
server.enqueue(
MockResponse()
.setHeadersDelay(10L, TimeUnit.MILLISECONDS)
.setBody("<cool/>")
)

val arguments = listOf(
"squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}",
Expand Down Expand Up @@ -74,7 +79,11 @@ class SquitRequestTaskConfigurableTasksTest {

@Test
fun `should execute scripts in configured order`() {
server.enqueue(MockResponse().setBody("<cool/>"))
server.enqueue(
MockResponse()
.setHeadersDelay(10L, TimeUnit.MILLISECONDS)
.setBody("<cool/>")
)

val arguments = listOf(
"squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}",
Expand Down Expand Up @@ -104,7 +113,11 @@ class SquitRequestTaskConfigurableTasksTest {

@Test
fun `should only execute pre db script and post script`() {
server.enqueue(MockResponse().setBody("<cool/>"))
server.enqueue(
MockResponse()
.setHeadersDelay(10L, TimeUnit.MILLISECONDS)
.setBody("<cool/>")
)

val arguments = listOf(
"squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}",
Expand Down

0 comments on commit 6b20b53

Please sign in to comment.