Skip to content

Commit 5258e6a

Browse files
authored
test(server): add test showing incorrect behavior for failed binding generation (#1930)
To be able to test the fix in #1924.
1 parent 2694c9d commit 5258e6a

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

jit-binding-server/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ dependencies {
2626

2727
implementation(projects.mavenBindingBuilder)
2828
implementation(projects.sharedInternal)
29+
30+
testImplementation("io.ktor:ktor-server-test-host")
2931
}
3032

3133
application {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package io.github.typesafegithub.workflows.jitbindingserver
2+
3+
import io.kotest.core.spec.style.FunSpec
4+
import io.kotest.matchers.shouldBe
5+
import io.ktor.client.request.get
6+
import io.ktor.http.HttpStatusCode
7+
import io.ktor.server.routing.routing
8+
import io.ktor.server.testing.testApplication
9+
10+
class ArtifactRoutesTest :
11+
FunSpec({
12+
context("artifacts for a given version") {
13+
test("when binding generation fails") {
14+
testApplication {
15+
// Given
16+
application {
17+
routing {
18+
artifactRoutes(
19+
buildBindingsCache(
20+
buildVersionArtifacts = { error("An internal error occurred!") },
21+
),
22+
)
23+
}
24+
}
25+
26+
// When
27+
val response = client.get("some-owner/some-action/v4/some-action-v4.pom")
28+
29+
// Then
30+
// This is incorrect, and will be fixed in
31+
// https://github.com/typesafegithub/github-workflows-kt/pull/1924/
32+
response.status shouldBe HttpStatusCode.NotFound
33+
}
34+
}
35+
}
36+
})

0 commit comments

Comments
 (0)