Skip to content

Commit aa0504e

Browse files
committed
refactor(uts): split test sources into unit/integration tiers + per-tier Gradle tasks
Reorganise the uts module under a domain-rooted io.ably.lib.uts package that cleanly separates infrastructure from tests, and unit from integration: infra/ shared awaits (Utils.kt) infra/unit/ mock transports + ConnectionDetails builder infra/integration/ SandboxApp infra/integration/proxy/ ProxyManager, ProxySession unit/realtime/ ConnectionRecoveryTest (mocked) integration/proxy/realtime/ AuthReauthTest (sandbox + proxy) - The ConnectionDetails test builder no longer sits in io.ably.lib.types, so it obtains the package-private constructor reflectively (as liveobjects/TestUtils.kt does). - Add runUtsUnitTests / runUtsIntegrationTests Gradle tasks (filtered by package), mirroring runLiveObjectsUnitTests / runLiveObjectsIntegrationTests. - check.yml now runs :uts:runUtsUnitTests; integration-test.yml gains a check-uts job running :uts:runUtsIntegrationTests. - Bring uts/README.md and uts/index.html in sync with the new structure.
1 parent f98d464 commit aa0504e

25 files changed

Lines changed: 243 additions & 152 deletions

‎.github/workflows/check.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ jobs:
2323
distribution: 'temurin'
2424
- name: Set up Gradle
2525
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3
26-
- run: ./gradlew checkWithCodenarc checkstyleMain checkstyleTest runUnitTests runLiveObjectsUnitTests :uts:test
26+
- run: ./gradlew checkWithCodenarc checkstyleMain checkstyleTest runUnitTests runLiveObjectsUnitTests :uts:runUtsUnitTests

‎.github/workflows/integration-test.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,24 @@ jobs:
123123
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3
124124

125125
- run: ./gradlew runLiveObjectsIntegrationTests
126+
127+
check-uts:
128+
runs-on: ubuntu-latest
129+
permissions:
130+
contents: read
131+
steps:
132+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
133+
with:
134+
submodules: 'recursive'
135+
persist-credentials: false
136+
137+
- name: Set up the JDK
138+
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
139+
with:
140+
java-version: '17'
141+
distribution: 'temurin'
142+
143+
- name: Set up Gradle
144+
uses: gradle/actions/setup-gradle@d9c87d481d55275bb5441eef3fe0e46805f9ef70 # v3
145+
146+
- run: ./gradlew :uts:runUtsIntegrationTests

‎uts/README.md‎

Lines changed: 86 additions & 59 deletions
Large diffs are not rendered by default.

‎uts/build.gradle.kts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,15 @@ tasks.withType<Test>().configureEach {
3535
.getOrElse(""),
3636
)
3737
}
38+
39+
tasks.register<Test>("runUtsUnitTests") {
40+
filter {
41+
includeTestsMatching("io.ably.lib.uts.unit.*")
42+
}
43+
}
44+
45+
tasks.register<Test>("runUtsIntegrationTests") {
46+
filter {
47+
includeTestsMatching("io.ably.lib.uts.integration.*")
48+
}
49+
}

‎uts/index.html‎

Lines changed: 67 additions & 54 deletions
Large diffs are not rendered by default.

‎uts/src/test/kotlin/io/ably/lib/types/Utils.kt‎

Lines changed: 0 additions & 3 deletions
This file was deleted.
File renamed without changes.

uts/src/test/kotlin/io/ably/lib/Utils.kt renamed to uts/src/test/kotlin/io/ably/lib/uts/infra/Utils.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.ably.lib
1+
package io.ably.lib.uts.infra
22

33
import io.ably.lib.realtime.AblyRealtime
44
import io.ably.lib.realtime.Channel

uts/src/test/kotlin/io/ably/lib/test/helper/SandboxApp.kt renamed to uts/src/test/kotlin/io/ably/lib/uts/infra/integration/SandboxApp.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
package io.ably.lib.test.helper
1+
package io.ably.lib.uts.infra.integration
22

33
import com.google.gson.JsonElement
44
import com.google.gson.JsonParser
5+
import io.ably.lib.uts.infra.integration.proxy.ProxyManager
56
import io.ktor.client.*
67
import io.ktor.client.engine.cio.*
78
import io.ktor.client.network.sockets.*

uts/src/test/kotlin/io/ably/lib/test/helper/ProxyManager.kt renamed to uts/src/test/kotlin/io/ably/lib/uts/infra/integration/proxy/ProxyManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package io.ably.lib.test.helper
1+
package io.ably.lib.uts.infra.integration.proxy
22

33
import io.ktor.client.HttpClient
44
import io.ktor.client.call.body

0 commit comments

Comments
 (0)