You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "aglinxinyuan (via GitHub)" <gi...@apache.org> on 2026/05/03 04:13:19 UTC
[PR] test(amber): add unit test coverage for AmberMessage envelopes [texera]
aglinxinyuan opened a new pull request, #4829:
URL: https://github.com/apache/texera/pull/4829
### What changes were proposed in this PR?
Add `AmberMessageEnvelopesSpec` covering the engine message envelope layer:
- `WorkflowFIFOMessage` / `WorkflowRecoveryMessage` round-trip via case class accessors and the `WorkflowMessage` / `Serializable` traits
- `RecoveryPayload` subtypes (`UpdateRecoveryStatus`, `ResendOutputTo`, `NotifyFailedNode`) carry their args; the `ResendOutputTo` ActorRef field is exercised via a real Pekko `ActorSystem`
- `WorkflowMessage.getInMemSize` for a DataFrame payload, an empty-frame DataFrame, and the 200L default for any other `WorkflowFIFOMessagePayload`
- `WorkflowFIFOMessagePayload` / `DirectControlMessagePayload` trait wiring
The catch-all `case _ => 200L` for non-`WorkflowFIFOMessage` subtypes is intentionally not tested because `WorkflowMessage` is sealed and today has only one subtype, so that branch is dead by construction.
### Any related issues, documentation, discussions?
Closes #4828
### How was this PR tested?
`sbt "WorkflowExecutionService/testOnly org.apache.texera.amber.engine.common.ambermessage.AmberMessageEnvelopesSpec"` — 11/11 tests pass.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.7)
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(amber): add unit test coverage for AmberMessage envelopes [texera]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #4829:
URL: https://github.com/apache/texera/pull/4829#issuecomment-4365370604
## [Codecov](https://app.codecov.io/gh/apache/texera/pull/4829?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 42.83%. Comparing base ([`945849c`](https://app.codecov.io/gh/apache/texera/commit/945849ce4f7ba77091e930b53b0b35440e33b994?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`4dcaade`](https://app.codecov.io/gh/apache/texera/commit/4dcaade68058be9565779b00bba9f56988785c7c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 1 commits behind head on main.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #4829 +/- ##
============================================
- Coverage 42.84% 42.83% -0.01%
Complexity 2027 2027
============================================
Files 957 957
Lines 34077 34077
Branches 3753 3753
============================================
- Hits 14600 14598 -2
- Misses 18693 18695 +2
Partials 784 784
```
| [Flag](https://app.codecov.io/gh/apache/texera/pull/4829/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [python](https://app.codecov.io/gh/apache/texera/pull/4829/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `84.10% <ø> (-0.06%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/texera/pull/4829?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(amber): add unit test coverage for AmberMessage envelopes [texera]
Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan merged PR #4829:
URL: https://github.com/apache/texera/pull/4829
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(amber): add unit test coverage for AmberMessage envelopes [texera]
Posted by "aglinxinyuan (via GitHub)" <gi...@apache.org>.
aglinxinyuan commented on code in PR #4829:
URL: https://github.com/apache/texera/pull/4829#discussion_r3177871874
##########
amber/src/test/scala/org/apache/texera/amber/engine/common/ambermessage/AmberMessageEnvelopesSpec.scala:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.engine.common.ambermessage
+
+import org.apache.pekko.actor.{Address, ActorSystem}
+import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tuple}
+import org.apache.texera.amber.core.virtualidentity.{ActorVirtualIdentity, ChannelIdentity}
+import org.scalatest.flatspec.AnyFlatSpec
+
+class AmberMessageEnvelopesSpec extends AnyFlatSpec {
+
+ private val channel =
+ ChannelIdentity(ActorVirtualIdentity("from"), ActorVirtualIdentity("to"), isControl = false)
+
+ private val intSchema: Schema = Schema().add(new Attribute("v", AttributeType.INTEGER))
+ private def tuple(v: Int): Tuple =
+ Tuple
+ .builder(intSchema)
+ .add(intSchema.getAttribute("v"), Integer.valueOf(v))
+ .build()
+
+ // ---------------------------------------------------------------------------
+ // WorkflowFIFOMessage / WorkflowRecoveryMessage envelope shape
+ // ---------------------------------------------------------------------------
+
+ "WorkflowFIFOMessage" should "carry channelId, sequenceNumber, and payload as constructed" in {
+ val payload = DataFrame(Array(tuple(1)))
+ val msg = WorkflowFIFOMessage(channel, 7L, payload)
+ assert(msg.channelId == channel)
+ assert(msg.sequenceNumber == 7L)
+ assert(msg.payload == payload)
+ }
+
+ it should "be a WorkflowMessage and Serializable" in {
+ val msg = WorkflowFIFOMessage(channel, 0L, DataFrame(Array.empty))
+ assert(msg.isInstanceOf[WorkflowMessage])
+ assert(msg.isInstanceOf[Serializable])
+ }
+
+ "WorkflowRecoveryMessage" should "carry the sender and payload as constructed" in {
+ val from = ActorVirtualIdentity("worker-1")
+ val payload = UpdateRecoveryStatus(isRecovering = true)
+ val msg = WorkflowRecoveryMessage(from, payload)
+ assert(msg.from == from)
+ assert(msg.payload == payload)
+ }
+
+ // ---------------------------------------------------------------------------
+ // RecoveryPayload subtypes
+ // ---------------------------------------------------------------------------
+
+ "RecoveryPayload subtypes" should "carry their constructor arguments" in {
+ val update = UpdateRecoveryStatus(isRecovering = true)
+ assert(update.isRecovering)
+
+ val updateOff = UpdateRecoveryStatus(isRecovering = false)
+ assert(!updateOff.isRecovering)
+
+ val nodeFailure = NotifyFailedNode(Address("pekko", "test"))
+ assert(nodeFailure.addr == Address("pekko", "test"))
+ }
+
+ it should "exercise ResendOutputTo via a real ActorRef so the case class wires correctly" in {
+ val system = ActorSystem("amber-message-envelopes-test")
+ try {
+ val deadRef = system.deadLetters
+ val vid = ActorVirtualIdentity("downstream")
+ val payload = ResendOutputTo(vid, deadRef)
+ assert(payload.vid == vid)
+ assert(payload.ref == deadRef)
+ } finally {
+ system.terminate()
Review Comment:
Done in c4526fcb87 — moved to a suite-local `ActorSystem` and replaced the `terminate()` in `finally` with `TestKit.shutdownActorSystem(testSystem)` in an `afterAll` block, which blocks until shutdown completes (matching the rest of the Pekko specs in this repo).
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] test(amber): add unit test coverage for AmberMessage envelopes [texera]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #4829:
URL: https://github.com/apache/texera/pull/4829#discussion_r3177824237
##########
amber/src/test/scala/org/apache/texera/amber/engine/common/ambermessage/AmberMessageEnvelopesSpec.scala:
##########
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.engine.common.ambermessage
+
+import org.apache.pekko.actor.{Address, ActorSystem}
+import org.apache.texera.amber.core.tuple.{Attribute, AttributeType, Schema, Tuple}
+import org.apache.texera.amber.core.virtualidentity.{ActorVirtualIdentity, ChannelIdentity}
+import org.scalatest.flatspec.AnyFlatSpec
+
+class AmberMessageEnvelopesSpec extends AnyFlatSpec {
+
+ private val channel =
+ ChannelIdentity(ActorVirtualIdentity("from"), ActorVirtualIdentity("to"), isControl = false)
+
+ private val intSchema: Schema = Schema().add(new Attribute("v", AttributeType.INTEGER))
+ private def tuple(v: Int): Tuple =
+ Tuple
+ .builder(intSchema)
+ .add(intSchema.getAttribute("v"), Integer.valueOf(v))
+ .build()
+
+ // ---------------------------------------------------------------------------
+ // WorkflowFIFOMessage / WorkflowRecoveryMessage envelope shape
+ // ---------------------------------------------------------------------------
+
+ "WorkflowFIFOMessage" should "carry channelId, sequenceNumber, and payload as constructed" in {
+ val payload = DataFrame(Array(tuple(1)))
+ val msg = WorkflowFIFOMessage(channel, 7L, payload)
+ assert(msg.channelId == channel)
+ assert(msg.sequenceNumber == 7L)
+ assert(msg.payload == payload)
+ }
+
+ it should "be a WorkflowMessage and Serializable" in {
+ val msg = WorkflowFIFOMessage(channel, 0L, DataFrame(Array.empty))
+ assert(msg.isInstanceOf[WorkflowMessage])
+ assert(msg.isInstanceOf[Serializable])
+ }
+
+ "WorkflowRecoveryMessage" should "carry the sender and payload as constructed" in {
+ val from = ActorVirtualIdentity("worker-1")
+ val payload = UpdateRecoveryStatus(isRecovering = true)
+ val msg = WorkflowRecoveryMessage(from, payload)
+ assert(msg.from == from)
+ assert(msg.payload == payload)
+ }
+
+ // ---------------------------------------------------------------------------
+ // RecoveryPayload subtypes
+ // ---------------------------------------------------------------------------
+
+ "RecoveryPayload subtypes" should "carry their constructor arguments" in {
+ val update = UpdateRecoveryStatus(isRecovering = true)
+ assert(update.isRecovering)
+
+ val updateOff = UpdateRecoveryStatus(isRecovering = false)
+ assert(!updateOff.isRecovering)
+
+ val nodeFailure = NotifyFailedNode(Address("pekko", "test"))
+ assert(nodeFailure.addr == Address("pekko", "test"))
+ }
+
+ it should "exercise ResendOutputTo via a real ActorRef so the case class wires correctly" in {
+ val system = ActorSystem("amber-message-envelopes-test")
+ try {
+ val deadRef = system.deadLetters
+ val vid = ActorVirtualIdentity("downstream")
+ val payload = ResendOutputTo(vid, deadRef)
+ assert(payload.vid == vid)
+ assert(payload.ref == deadRef)
+ } finally {
+ system.terminate()
Review Comment:
This test creates a real ActorSystem but only calls `terminate()` in the `finally` block, which does not wait for shutdown to complete. The rest of the Scala Pekko tests clean systems up with `TestKit.shutdownActorSystem(system)` (for example `ControllerSpec` and `WorkerSpec`), because otherwise the system's threads can outlive the test and make the suite flaky or leave the fixed actor-system name unavailable on reruns in the same JVM.
--
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: notifications-unsubscribe@texera.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org