costajohnt opened a new pull request, #41372:
URL: https://github.com/apache/beam/pull/41372
The `default:` branch of `postCommitYamlIntegrationTests` in
`sdks/python/build.gradle` does `throw StopExecutionException("Unknown
yamlTestSet: ...")` without `new`. Groovy treats that as a method call, so a
typo in `-PyamlTestSet` fails with `Could not find method
StopExecutionException() for arguments [...]` instead of the intended message.
Just adding `new` would make things worse: `StopExecutionException` tells
Gradle to skip the rest of the task, so the task would report success without
running any tests. This switches it to `throw new GradleException(...)`, which
is what other Beam build scripts use for bad input (for example
`sdks/java/container/common.gradle` and
`sdks/python/test-suites/dataflow/common.gradle`). Valid test sets are
unaffected.
I found this with a Groovy linter. There's no issue for it, and since it's a
one-line build script fix I didn't open one first. Happy to file one if you'd
prefer.
How I verified it: I didn't run Beam's own build for this (the task depends
on the expansion service shadow jars). Instead I ran a small standalone Gradle
8.8 project with the same `doLast` switch and three variants of the `default:`
branch, invoked with `-PyamlTestSet=bogus`:
- current code: `BUILD FAILED`, `Could not find method
StopExecutionException() for arguments [Unknown yamlTestSet: bogus. ...]`
- `throw new StopExecutionException(...)`: `BUILD SUCCESSFUL`, exit 0, the
test step is skipped silently
- `throw new GradleException(...)` (this PR): `BUILD FAILED` with `Unknown
yamlTestSet: bogus. ...`
With the fix, `-PyamlTestSet=data` still runs the test step.
--
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]