Skip to content

Commit

Permalink
CustomerIOIntegrationTest fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mrehan27 committed Sep 15, 2023
1 parent b72642c commit ed71cea
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import io.customer.commontest.extensions.enqueueNoInternetConnection
import io.customer.commontest.extensions.enqueueSuccessful
import io.customer.sdk.data.request.MetricEvent
import io.customer.sdk.extensions.random
import java.util.concurrent.TimeUnit
import kotlinx.coroutines.test.runTest
import org.amshove.kluent.shouldBeEqualTo
import org.junit.Test
Expand All @@ -22,7 +23,13 @@ class CustomerIOIntegrationTest : BaseIntegrationTest() {
// A customer device could have tens of thousands of background queue tasks in it. There is no limit at this time so, this test function tries to
// find a balance between keeping the test suite execution time low but being a quality test.
val numberOfTasksToAddInQueue = 5000
setup(cioConfig = createConfig(backgroundQueueMinNumberOfTasks = numberOfTasksToAddInQueue + 1)) // set BQ to only be executed manually
// set BQ to only be executed manually
getCustomerIOBuilder(
cioConfig = createConfig(
backgroundQueueMinNumberOfTasks = numberOfTasksToAddInQueue + 1,
backgroundQueueSecondsDelay = TimeUnit.MINUTES.toSeconds(10).toDouble()
)
).build()

for (i in 0 until numberOfTasksToAddInQueue) {
CustomerIO.instance().identify(String.random)
Expand All @@ -43,7 +50,13 @@ class CustomerIOIntegrationTest : BaseIntegrationTest() {
@Test
fun test_backgroundQueueExecuteLotsOfTasks_givenSuccessAllTasks_expectThrowNoError() = runTest {
val numberOfTasksToAddInQueue = 5000
setup(cioConfig = createConfig(backgroundQueueMinNumberOfTasks = numberOfTasksToAddInQueue + 1)) // set BQ to only be executed manually
// set BQ to only be executed manually
getCustomerIOBuilder(
cioConfig = createConfig(
backgroundQueueMinNumberOfTasks = numberOfTasksToAddInQueue + 1,
backgroundQueueSecondsDelay = TimeUnit.MINUTES.toSeconds(10).toDouble()
)
).build()

for (i in 0 until numberOfTasksToAddInQueue) {
CustomerIO.instance().identify(String.random)
Expand Down

0 comments on commit ed71cea

Please sign in to comment.