no-issue: disable tests conditionally when binary is not present#1191
no-issue: disable tests conditionally when binary is not present#1191ricardozanini wants to merge 6 commits intoserverlessworkflow:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a JUnit 5 annotation/extension to conditionally disable tests when required external binaries (e.g., protoc, python) are not available on the executing machine, improving mvn clean install reliability across environments.
Changes:
- Introduce
@DisabledIfBinaryUnavailableplusBinaryCheckConditionJUnit 5ExecutionCondition. - Apply the new annotation to gRPC tests requiring
protoc. - Apply the new annotation to the parameterized custom function test requiring
python.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/DisabledIfBinaryUnavailable.java | New annotation to register the binary-check execution condition. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/BinaryCheckCondition.java | New JUnit 5 ExecutionCondition that runs a command to determine binary availability. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcUnaryTest.java | Disable test class when protoc is unavailable. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcUnaryArgsExprTest.java | Disable test class when protoc is unavailable. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcServerStreamingTest.java | Disable test class when protoc is unavailable. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcClientStreamingTest.java | Disable test class when protoc is unavailable. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcBiDirectionalStreamingTest.java | Disable test class when protoc is unavailable. |
| impl/test/src/test/java/io/serverlessworkflow/impl/test/CustomFunctionTest.java | Disable the python-dependent parameterized test when python is unavailable. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/BinaryCheckCondition.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/BinaryCheckCondition.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/BinaryCheckCondition.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcUnaryTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcUnaryArgsExprTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcServerStreamingTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcClientStreamingTest.java
Outdated
Show resolved
Hide resolved
.../test/src/test/java/io/serverlessworkflow/impl/test/grpc/GrpcBiDirectionalStreamingTest.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/BinaryCheckCondition.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/BinaryCheckUtil.java
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/ProtocCheckCondition.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/ProtocCheckCondition.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/ProtocCheckCondition.java
Outdated
Show resolved
Hide resolved
impl/test/src/test/java/io/serverlessworkflow/impl/test/junit/PythonCheckCondition.java
Outdated
Show resolved
Hide resolved
fjtirado
left a comment
There was a problem hiding this comment.
Good idea.
I have some non trivial comments regarding implementation, though
|
@ricardozanini I just realized that, if protoc binary is not in classpath, it will be extracted from the jar dependency, so for grpc I do not think the check is needed (what Im trying to say if that the test will work in systems, like mine, where protoc is not installed, do not need to disable it, because isProtoCAvailable will always be true once the protoc dependency is there) See https://github.com/os72/protoc-jar/blob/master/src/main/java/com/github/os72/protocjar/Protoc.java#L189-L230. In practise, something will be really screwed up if isProtoCAvailable were false, and probably in that case we should fail CI rather than go on. |
|
@fjtirado either protocjar implementation is wrong, or our usage is. Because on my system, which protoc is also definitely NOT installed, the tests fail with the "protoc is not found in the system path". Or we fix protoc, or we disable the tests on systems that the JAR can't identify. |
Hmmm, probably a Mac thing ;), ok, lets disable both, the grpc and the python. |
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
9706f7f to
d29fef7
Compare
Signed-off-by: Ricardo Zanini <ricardozanini@gmail.com>
|
@fjtirado I believe I fixed the comments you added. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Many thanks for submitting your Pull Request ❤️!
What this PR does / why we need it:
Sometimes, a local machine environment might not have
pythonorprotocinstalled to run "unit" tests. In my opinion, these tests should be ITs and be on a specific profile.However, if we want to run as unit tests and they depend on the environment where they're running, we disable the test if needed.
Special notes for reviewers:
mvn clean installnow runs smoothly if python or grpc are not available.Additional information (if needed):