You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@texera.apache.org by "Ma77Ball (via GitHub)" <gi...@apache.org> on 2026/06/15 00:19:29 UTC
[I] Add unit test coverage for GlobalPortIdentitySerde [texera]
Ma77Ball opened a new issue, #5717:
URL: https://github.com/apache/texera/issues/5717
### Task Summary
Add a ScalaTest spec for `GlobalPortIdentitySerde`, which currently has no test coverage. This is a good first issue: the target is small, pure (no I/O, no mocks, no DB), and has clearly documented behavior, so it is a self-contained way to get familiar with the repo's Scala test workflow.
**What this class does**
`GlobalPortIdentitySerde` converts a `GlobalPortIdentity` to and from a compact, human-readable string. The string is embedded in VFS URIs and file paths, so the format deliberately avoids underscores and rejects negative port ids. Round-tripping (serialize then deserialize) must return an equal object.
**Where the code lives**
Source: `common/workflow-core/src/main/scala/org/apache/texera/amber/util/serde/GlobalPortIdentitySerde.scala`
- `serializeAsString` (an implicit `SerdeOps` on `GlobalPortIdentity`) produces:
`(logicalOpId=...,layerName=...,portId=...,isInternal=...,isInput=...)`
It calls `require(...)` to reject an underscore in `logicalOpId` or `layerName`, and a negative `portId`.
- `deserializeFromString` parses that string back into a `GlobalPortIdentity` via a regex, rejecting a negative `portId` and any malformed input with `IllegalArgumentException`.
**Where the test goes**
Create: `common/workflow-core/src/test/scala/org/apache/texera/amber/util/serde/GlobalPortIdentitySerdeSpec.scala`
(test path mirrors the source path; file name is `<ClassName>Spec.scala`).
**What to cover**
- Format correctness: serializing a known `GlobalPortIdentity` yields the exact expected string, and the `isInternal` / `isInput` flags are rendered correctly.
- Underscore validation: an underscore in `logicalOpId` throws `IllegalArgumentException`; same for `layerName`.
- Negative-portId rejection: on the serialize path, and on the deserialize path (a `portId=-1` in the input string).
- Malformed input: a string that does not match the format throws `IllegalArgumentException`.
- Round-trip: for several combinations of `internal` (true/false), `input` (true/false), and `portId` (0, 1, 42), `deserializeFromString(x.serializeAsString)` equals `x`.
**How to write it (conventions)**
- Use `AnyFlatSpec with Matchers`, the style used by neighboring specs. A good reference to copy structure from is `common/workflow-core/src/test/scala/org/apache/texera/amber/util/VirtualIdentityUtilsSpec.scala`.
- Build inputs with `GlobalPortIdentity(opId = PhysicalOpIdentity(OperatorIdentity("op"), "layer"), portId = PortIdentity(id = 0, internal = false), input = false)`. These are protobuf-generated case classes (defined in `common/workflow-core/src/main/protobuf/org/apache/texera/amber/core/{workflow,virtualidentity}.proto`).
- Bring the extension method into scope with `import org.apache.texera.amber.util.serde.GlobalPortIdentitySerde.SerdeOps` so `.serializeAsString` is available.
- Add the standard Apache license header at the top of the file (copy it from any existing `*Spec.scala`).
**How to run it**
`sbt "WorkflowCore/testOnly org.apache.texera.amber.util.serde.GlobalPortIdentitySerdeSpec"`
Note: the sbt build runs JaCoCo coverage instrumentation, and JaCoCo 0.8.11 cannot read Java 25 bytecode. If you hit `Unsupported class file major version 69`, build under JDK 17 (the version the project targets), for example by setting `JAVA_HOME` to a JDK 17 install before running sbt.
**Definition of done**
A new `GlobalPortIdentitySerdeSpec.scala` exists at the path above, covers all cases listed, and passes locally. Run `sbt scalafmtAll` before committing.
### Task Type
- [x] Testing / QA
--
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.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Add unit test coverage for GlobalPortIdentitySerde [texera]
Posted by "Ma77Ball (via GitHub)" <gi...@apache.org>.
Ma77Ball commented on issue #5717:
URL: https://github.com/apache/texera/issues/5717#issuecomment-4703568216
reserved for beginner task
--
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: [I] Add unit test coverage for GlobalPortIdentitySerde [texera]
Posted by "Yicong-Huang (via GitHub)" <gi...@apache.org>.
Yicong-Huang closed issue #5717: Add unit test coverage for GlobalPortIdentitySerde
URL: https://github.com/apache/texera/issues/5717
--
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: [I] Add unit test coverage for GlobalPortIdentitySerde [texera]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #5717:
URL: https://github.com/apache/texera/issues/5717#issuecomment-4703558412
<!-- texera:template-compliance -->
👋 Thanks for opening this issue, @Ma77Ball!
It looks like the issue description doesn't quite follow our template yet:
- This issue doesn't appear to use one of our templates (Bug, Feature, or Task). Please open it using a template so the required details are captured.
Filling out the template helps reviewers understand and triage your contribution faster. Please edit the description to complete it. This message will disappear automatically once the template is followed.
You can find the template prompts by editing the description, or see [CONTRIBUTING.md](https://github.com/apache/texera/blob/main/CONTRIBUTING.md) for the full contribution flow.
--
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: [I] Add unit test coverage for GlobalPortIdentitySerde [texera]
Posted by "eugenegujing (via GitHub)" <gi...@apache.org>.
eugenegujing commented on issue #5717:
URL: https://github.com/apache/texera/issues/5717#issuecomment-4704048555
/take
--
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