Skip to content

Commit

Permalink
Running server tests in parallel (#1314)
Browse files Browse the repository at this point in the history
  • Loading branch information
craigatk committed May 22, 2024
1 parent 6b36667 commit 96e4899
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions server/server-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ dependencies {
testImplementation "com.github.tomakehurst:wiremock-jre8:$wiremockVersion"
}

test {
maxParallelForks = Math.floorDiv(Runtime.runtime.availableProcessors(), 2) + 1
}

task cleanStaticResources(type: Delete) {
delete "${projectDir}/src/main/resources/static/"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ class SchedulerTest : DatabaseRepositoryTestCase() {

val schedulerLock = SchedulerLock(dataSource)
val scheduler = Scheduler(schedulerLock)
val jobName = "my_scheduled_job"

val scheduleDuration =
measureTime {
scheduler.scheduleJob(ScheduledJob("my_job", scheduledJob, ScheduleDelay(4, TimeUnit.SECONDS)))
scheduler.scheduleJob(ScheduledJob(jobName, scheduledJob, ScheduleDelay(4, TimeUnit.SECONDS)))

await until { schedulerCalled }
}

expectThat(scheduleDuration.inWholeSeconds).isGreaterThanOrEqualTo(4)

expectThat(scheduler.findScheduledJob("my_job")).isNotNull().and {
get { name }.isEqualTo("my_job")
expectThat(scheduler.findScheduledJob(jobName)).isNotNull().and {
get { name }.isEqualTo(jobName)
get { scheduleDelay }.isEqualTo(ScheduleDelay(4, TimeUnit.SECONDS))
}
}
Expand Down

0 comments on commit 96e4899

Please sign in to comment.