Skip to content

Commit

Permalink
Fix incorrectly overridden project groups by JvmTestSuite. (#4884)
Browse files Browse the repository at this point in the history
Motivation:

`group` was set in JvmTestSuite's configuration to change the test task's group, but `Project.group` was changed unintentionally. https://github.com/line/armeria/blob/e15c7b7809db6d77c6798c237707e942fceb51bb/core/build.gradle#L178-L180

The overridden group caused to publish Armeria artifacts to `Verification` org in Sonatype snapshot storage.
https://github.com/line/armeria/actions/runs/5010142242/jobs/8979748543#step:8:1273

Modifications:

- Override the group of a test task in `testTask.configure` block.

Result:

Fixed unintentionally overridden Gradle project group information.
  • Loading branch information
ikhoon authored May 22, 2023
1 parent b78d951 commit f211673
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 25 deletions.
6 changes: 3 additions & 3 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ testing {
suites {
testStreaming(JvmTestSuite) {

group = 'Verification'
description = 'Runs the streaming tests.'

targets {
all {
testTask.configure {
group = 'Verification'
description = 'Runs the streaming tests.'

dependsOn(tasks.shadedTestClasses)
// Use small heap for streaming tests to quickly ensure we can stream the content larger than heap.
maxHeapSize = '64m'
Expand Down
2 changes: 1 addition & 1 deletion dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jwt = "4.3.0"
kafka = "3.4.0"
kotlin = "1.8.10"
kotlin-coroutine = "1.6.4"
ktlint-gradle-plugin = "11.1.0"
ktlint-gradle-plugin = "11.3.2"
logback = "1.2.11"
micrometer = "1.10.5"
micrometer13 = "1.3.20"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,12 @@ class MarkdownDescriptionService {
@Get("/markdown")
fun markdown(
@Description(value = "`Param` description", markup = Markup.MARKDOWN)
@Param param1: String,
@Param
param1: String,
@Param param2: String,
@Description("param3 description")
@Param param3: MarkdownEnumParam
@Param
param3: MarkdownEnumParam
): MarkdownDescriptionResult {
return MarkdownDescriptionResult(
result1 = param1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class MainService(private val backendClient: WebClient) : HttpService {
override fun serve(ctx: ServiceRequestContext, req: HttpRequest): HttpResponse {
val ctxExecutor = ctx.eventLoop()
val response = GlobalScope.future(ctxExecutor.asCoroutineDispatcher()) {

val numsFromRequest = async { fetchFromRequest(ctx, req) }
val numsFromDb = async { fetchFromFakeDb(ctx) }
val nums = awaitAll(numsFromRequest, numsFromDb).flatten()
Expand Down Expand Up @@ -88,10 +87,10 @@ class MainService(private val backendClient: WebClient) : HttpService {

val nums = mutableListOf<Long>()
for (
token in Iterables.concat(
NUM_SPLITTER.split(aggregatedHttpRequest.path().substring(1)),
NUM_SPLITTER.split(aggregatedHttpRequest.contentUtf8())
)
token in Iterables.concat(
NUM_SPLITTER.split(aggregatedHttpRequest.path().substring(1)),
NUM_SPLITTER.split(aggregatedHttpRequest.contentUtf8())
)
) {
nums.add(token.toLong())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class ValidationExceptionHandler : ExceptionHandlerFunction {
Instant.now().toString()
)
)
} else ExceptionHandlerFunction.fallthrough()
} else {
ExceptionHandlerFunction.fallthrough()
}
}
}

Expand Down
10 changes: 8 additions & 2 deletions kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,14 @@ testing {
val testNg by registering(JvmTestSuite::class) {
useTestNG()

group = "Verification"
description = "Runs the TestNG unit tests"
targets {
all {
testTask.configure {
group = "Verification"
description = "Runs the TestNG unit tests"
}
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ data class ExampleQueries2(
@Param
val topic: String,
@Param
val group: String,
val group: String
)

data class ExampleBody(val name: String, val limit: Int?)
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ internal class FlowAnnotatedServiceTest {
@Test
fun test_jsonStreaming_string() = runBlocking {
client.get("/flow/json-string-streaming") shouldProduce listOf(
"\u001E\"hello\"\n", "\u001E\"world\"\n", ""
"\u001E\"hello\"\n",
"\u001E\"world\"\n",
""
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@ class NullableTypeSupportTest {
"/nullable-annot/value-resolver",
object {
@Get("/of-query-param")
fun ofQueryParam(@Param a: String, @Nullable @Param b: String?) =
fun ofQueryParam(
@Param a: String,
@Nullable
@Param
b: String?
) =
HttpResponse.of("a: $a, b: $b")

@Get("/of-request-converter")
Expand Down Expand Up @@ -142,16 +147,28 @@ class NullableTypeSupportTest {
class Baz(@Param("a") val a: String, @Param("b") val b: String?)

// Check for backward-compatibility
class Baz0(@Param("a") val a: String, @Nullable @Param("b") val b: String?)
class Baz0(
@Param("a") val a: String,
@Nullable
@Param("b")
val b: String?
)

class Qux {
@Param("a") lateinit var a: String
@Param("b") var b: String? = null
@Param("a")
lateinit var a: String

@Param("b")
var b: String? = null
}

class Qux0 {
@Param("a") lateinit var a: String
@Nullable @Param("b") var b: String? = null
@Param("a")
lateinit var a: String

@Nullable
@Param("b")
var b: String? = null
}

class Quux {
Expand All @@ -169,7 +186,12 @@ class NullableTypeSupportTest {
lateinit var a: String
var b: String? = null

fun setter(@Param("a") a: String, @Nullable @Param("b") b: String?) {
fun setter(
@Param("a") a: String,
@Nullable
@Param("b")
b: String?
) {
this.a = a
this.b = b
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ class SuspendingAnnotatedServiceTest {

@Get("/bar-in-http-result")
suspend fun barInHttpResult() = HttpResult.of(
ResponseHeaders.of(HttpStatus.BAD_REQUEST, "x-custom-header", "value"), Bar()
ResponseHeaders.of(HttpStatus.BAD_REQUEST, "x-custom-header", "value"),
Bar()
)
}
)
Expand All @@ -314,7 +315,8 @@ class SuspendingAnnotatedServiceTest {
private fun exceptionHandlerFunction() = ExceptionHandlerFunction { _, _, cause ->
log.info(cause.message, cause)
HttpResponse.of(
HttpStatus.INTERNAL_SERVER_ERROR, MediaType.PLAIN_TEXT_UTF_8,
HttpStatus.INTERNAL_SERVER_ERROR,
MediaType.PLAIN_TEXT_UTF_8,
cause.javaClass.simpleName
)
}
Expand Down

0 comments on commit f211673

Please sign in to comment.