Skip to content

Commit 4f1bd9a

Browse files
committed
Increasing timeouts to make GH actions happy
1 parent b1b78f0 commit 4f1bd9a

File tree

4 files changed

+51
-30
lines changed

4 files changed

+51
-30
lines changed

.github/workflows/test.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ jobs:
2121
path: :connector:connector-aws
2222
containers: localstack
2323
runner: macos-latest
24-
task: test
24+
gradle-command: >
25+
:connector:connector-aws:connector-aws-lambda:test
26+
:connector:connector-aws:connector-aws-s3:test
27+
:connector:connector-aws:connector-aws-sqs:test
28+
:connector:connector-aws:connector-aws-sns:test
29+
:connector:connector-aws:connector-aws-ses:test
30+
--parallel
2531
- module: Azure Queue Storage
2632
path: :connector:connector-azure:connector-azure-queue-storage
2733
containers: azurite
@@ -71,31 +77,41 @@ jobs:
7177

7278
steps:
7379
- uses: actions/checkout@v4
80+
7481
- name: Restore Colima data [if needed] [macOS only]
7582
if: ${{ matrix.containers && runner.os == 'macos' }}
7683
uses: actions/cache@v3
7784
with:
7885
key: ${{ env.colima-command }}
7986
path: ~/.colima
8087
restore-keys: ${{ env.colima-command }}
88+
8189
- name: Install Docker [if needed] [macOS only]
8290
if: ${{ matrix.containers && runner.os == 'macos' }}
8391
run: |
8492
brew install docker docker-compose
8593
mkdir -p ~/.docker/cli-plugins
8694
ln -sfn /usr/local/opt/docker-compose/bin/docker-compose ~/.docker/cli-plugins/docker-compose
95+
8796
- name: Run Colima [if needed] [macOS only]
8897
if: ${{ matrix.containers && runner.os == 'macos' }}
8998
run: colima ${{ env.colima-command }}
99+
90100
- name: Run docker-compose [if needed]
91101
if: ${{ matrix.containers }}
92102
run: docker compose up ${{ matrix.containers }} -d
103+
93104
- name: Set up JDK 17
94105
uses: actions/setup-java@v4
95106
with:
96107
java-version: '17'
97108
distribution: 'temurin'
109+
110+
- name: Set up Gradle
111+
uses: gradle/actions/setup-gradle@v3
112+
98113
- name: Run tests for ${{ matrix.module }}
99-
uses: gradle/gradle-build-action@v3
100-
with:
101-
arguments: ${{ matrix.path }}:${{ matrix.task || 'allTests' }}
114+
env:
115+
task: ${{ matrix.path }}:${{ matrix.task || 'allTests' }}
116+
run: |
117+
./gradlew ${{ matrix.gradle-command || env.task }}

core/src/commonTest/kotlin/com/river/core/FlowAsyncExtKtTest.kt

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import kotlinx.coroutines.flow.flowOf
1616
import kotlinx.coroutines.flow.toList
1717
import kotlin.time.Duration
1818
import kotlin.time.Duration.Companion.milliseconds
19-
import kotlin.time.Duration.Companion.seconds
19+
import kotlin.time.Duration.Companion.minutes
2020
import kotlin.time.measureTime
2121
import kotlin.time.measureTimedValue
2222

@@ -45,7 +45,9 @@ class FlowAsyncExtKtTest : FunSpec({
4545
it * 2
4646
}
4747

48-
retry(5, 20.seconds) {
48+
// The high max retries is due to macOS incredibly slow build on GH Actions
49+
// It causes the test to slow down, so time-related tests get quite unpredictable
50+
retry(20, 1.minutes) {
4951
val counter = AtomicReference(0)
5052

5153
sourceFlow
@@ -61,18 +63,19 @@ class FlowAsyncExtKtTest : FunSpec({
6163

6264
// Measure the time taken to receive two items
6365
measureTime {
64-
// First item should be received in >= 500 ms & <= 520 ms
66+
// First item should be received in >= 500 ms & <= 600 ms
6567
assertSoftly(ensureNext()) { duration ->
6668
duration shouldBeGreaterThan 480.milliseconds
67-
duration shouldBeLessThanOrEqualTo 520.milliseconds
69+
// Once again, this is due to macOS slow builds on GH Actions
70+
duration shouldBeLessThanOrEqualTo 600.milliseconds
6871
}
6972

7073
repeat(9) {
7174
// The other 9 items should be almost immediate
72-
ensureNext() shouldNotBeGreaterThan 6.milliseconds
75+
ensureNext() shouldNotBeGreaterThan 10.milliseconds
7376
}
7477

75-
} shouldBeLessThanOrEqualTo 550.milliseconds
78+
} shouldBeLessThanOrEqualTo 650.milliseconds
7679
}
7780

7881
awaitComplete()
@@ -81,7 +84,7 @@ class FlowAsyncExtKtTest : FunSpec({
8184
}
8285

8386
test("unorderedMapAsync should correctly transform each element") {
84-
val sourceFlow = flowOf(100, 50, 10)
87+
val sourceFlow = flowOf(500, 100, 5)
8588

8689
val result =
8790
sourceFlow
@@ -92,22 +95,22 @@ class FlowAsyncExtKtTest : FunSpec({
9295
.toList()
9396

9497
/**
95-
* The assertion shouldContainInOrder expects the elements in the specific order [100, 20, 200].
98+
* The assertion shouldContainInOrder expects the elements in the specific order [200, 10, 1000].
9699
*
97100
* Despite the function being unordered, in this specific case, the output will be ordered due to the
98101
* interplay of processing times and concurrency limit.
99102
*
100103
* Lemme explain how it works exactly:
101104
*
102-
* - The first element (100) will start processing and take 100 milliseconds.
103-
* - Meanwhile, the second element (50) starts and finishes in 50 milliseconds.
104-
* - The third element (10) starts processing after the second but finishes quickly in 10 milliseconds.
105-
* - By the time the first element (100) finishes, the other two are already done.
105+
* - The first element (500) will start processing and take 500 milliseconds.
106+
* - Meanwhile, the second element (100) starts and finishes in 100 milliseconds.
107+
* - The third element (5) starts processing after the second but finishes quickly in 5 milliseconds.
108+
* - By the time the first element (500) finishes, the other two are already done.
106109
*
107-
* So, the order of completion is 50 (20 after transformation), 10 (20 after transformation),
108-
* and finally 100 (200 after transformation).
110+
* So, the order of completion is 100 (200 after transformation), 5 (10 after transformation),
111+
* and finally 500 (1000 after transformation).
109112
*/
110-
result shouldContainInOrder listOf(100, 20, 200)
113+
result shouldContainInOrder listOf(200, 10, 1000)
111114
}
112115

113116
test("flatMapIterableAsync should correctly transform and flatten each element") {
@@ -126,7 +129,7 @@ class FlowAsyncExtKtTest : FunSpec({
126129
}
127130

128131
test("unorderedFlatMapIterableAsync should correctly transform and flatten each element with specific processing times") {
129-
val sourceFlow = flowOf(100, 50, 10)
132+
val sourceFlow = flowOf(500, 100, 5)
130133

131134
val result =
132135
sourceFlow
@@ -137,21 +140,21 @@ class FlowAsyncExtKtTest : FunSpec({
137140
.toList()
138141

139142
/**
140-
* The assertion shouldContainInOrder expects the elements in the specific order [100, 20, 200].
143+
* The assertion shouldContainInOrder expects the elements in the specific order [100, 200, 5, 10, 500, 1000].
141144
*
142145
* Despite the function being unordered, in this specific case, the output will be ordered due to the
143146
* interplay of processing times and concurrency limit.
144147
*
145148
* Lemme explain how it works exactly:
146149
*
147-
* - The first element (100) will start processing and take 100 milliseconds.
148-
* - Meanwhile, the second element (50) starts and finishes in 50 milliseconds.
149-
* - The third element (10) starts processing after the second but finishes quickly in 10 milliseconds.
150-
* - By the time the first element (100) finishes, the other two are already done.
150+
* - The first element (500) will start processing and take 500 milliseconds.
151+
* - Meanwhile, the second element (100) starts and finishes in 100 milliseconds.
152+
* - The third element (5) starts processing after the second but finishes quickly in 5 milliseconds.
153+
* - By the time the first element (500) finishes, the other two are already done.
151154
*
152-
* So, the order of completion is 50 (100 after transformation), 10 (20 after transformation),
153-
* and finally 100 (200 after transformation).
155+
* So, the order of completion is 100 (200 after transformation), 5 (10 after transformation),
156+
* and finally 500 (1000 after transformation).
154157
*/
155-
result shouldContainInOrder listOf(50, 100, 10, 20, 100, 200)
158+
result shouldContainInOrder listOf(100, 200, 5, 10, 500, 1000)
156159
}
157160
})

core/src/commonTest/kotlin/com/river/core/FlowExtKtTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class FlowExtKtTest : FunSpec({
7171

7272
test("should transform the flow into a list based on the time window") {
7373
flowOf(2, 4, 6, 8, 10, 12, 14, 16)
74-
.onEach { delay(190) }
75-
.toList(10, 600.milliseconds) shouldBe listOf(2, 4, 6)
74+
.onEach { delay(300) }
75+
.toList(10, 1150.milliseconds) shouldBe listOf(2, 4, 6)
7676
}
7777

7878
test("should chunk the items based on the count") {

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
org.gradle.jvmargs=-Xmx4096M
22
kotlin.mpp.androidSourceSetLayoutVersion=2
3+
org.gradle.caching=true
4+
org.gradle.configureondemand=true

0 commit comments

Comments
 (0)