Skip to content

Optimize TrivialControlSpec test runtime #4505

@Yicong-Huang

Description

@Yicong-Huang

Task Summary

TrivialControlSpec (amber/src/test/scala/org/apache/texera/amber/engine/architecture/control/TrivialControlSpec.scala) takes ~70s in CI for only 8 simple tests, making it the single slowest spec in the Scala test step (~22% of total backend test time).

The bottleneck is in testControl[T]:

probe.receiveWhile(5.minutes, 10.seconds) {
  case GetActorRef(...) => ...
  case NetworkMessage(...) => ... flag += 1
  case other => //skip
}

case other matches every message, so receiveWhile never exits via partial-function mismatch. Once all expected returns are received, the test sits idle for the full 10s receiveWhile idle timeout before the loop returns. With 8 tests, that's ~80s of pure waiting.

Replacing receiveWhile with a manual loop that exits as soon as flag == expectedValues.length brings the spec from ~71s to ~1s in local runs.

Priority

P2 – Medium

Task Type

  • Refactor / Cleanup
  • Testing / QA

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions