aaron-y-chen commented on code in PR #76269:
URL: https://github.com/apache/airflow/pull/76269#discussion_r4722998936
##########
java-sdk/sdk/src/test/kotlin/org/apache/airflow/sdk/execution/CommTest.kt:
##########
@@ -108,53 +108,38 @@ class CommsTest {
Assertions.assertEquals(expected, actual)
}
+ private fun successFrame(
+ type: String,
+ vararg fields: Pair<String, Any>,
+ ): (Int) -> ByteArray =
+ { id ->
+ val out = ByteArrayOutputStream()
+ MessagePack.newDefaultPacker(out).use { packer ->
+ packer.packArrayHeader(3)
+ packer.packInt(id)
+ packer.packMapHeader(fields.size + 1)
+ packer.packString("type")
+ packer.packString(type)
+ for ((key, value) in fields) {
+ packer.packString(key)
+ when (value) {
+ is Int -> packer.packInt(value)
+ is Boolean -> packer.packBoolean(value)
+ is String -> packer.packString(value)
+ else -> error("unsupported fixture value: $value")
Review Comment:
Nice suggestion! I switched to `ValueFactory` so the fixtures specify their
MessagePack types directly and `bodyFrame` can just call `packValue`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]