Thanks both for the tips! Much appreciated 🙂 On Mon, Apr 5, 2021 at 13:56 Tyson Hamilton <[email protected]> wrote:
> There are some Java tips > <https://cwiki.apache.org/confluence/display/BEAM/Java+Tips> [1] in the > Apache Beam wiki that show how to run a single test and a pre-commit like > command as Alex shared. I often turn to Jenkins to figure out the correct > gradle command as well, since it is printed near the top of the console > log. For example the precommit logs > <https://ci-beam.apache.org/job/beam_PreCommit_Java_Commit/16928/consoleFull> > [2] > show: > > /home/jenkins/jenkins-slave/workspace/beam_PreCommit_Java_Commit@2/src/gradlew > -PdisableSpotlessCheck=true --continue --max-workers=12 > -Dorg.gradle.jvmargs=-Xms2g -Dorg.gradle.jvmargs=-Xmx4g > -Pdocker-pull-licenses :javaPreCommit > > Which means I would try running: > > ./gradlew :javaPreCommit > > Which is defined in build.gradle.kts [3]. > > [1]: https://cwiki.apache.org/confluence/display/BEAM/Java+Tips > [2]: > https://ci-beam.apache.org/job/beam_PreCommit_Java_Commit/16928/consoleFull > [3]: https://github.com/apache/beam/blob/master/build.gradle.kts#L138 > > On Mon, Apr 5, 2021 at 10:26 AM Alex Amato <[email protected]> wrote: > >> This is what I do >> >> This is something you can run before you submit to catch many style >> issues, compile issues and what not. This will take a few minutes, but you >> won't have to wait for a very long presubmit to catch these basic issues. >> For Java PRs >> time ./gradlew spotlessApply && ./gradlew checkstyleMain checkstyleTest >> javadoc spotbugsMain compileJava compileTestJava >> >> For python PRs >> ./gradlew lint :beam-sdks-python:docs :beam-sdks-python:lintPy27 >> :beam-sdks-python:lintPy27_3 :beam-sdks-python:lintPy3 >> :beam-sdks-python:py38:formatter >> OR the much faster command can catch most issues: >> tox -e py27-lint,py3-lint >> >> Then for tests. I just push my branch and update my PR and let it run >> there. If a specific test fails, I try to figure out how to run it locally >> and debug it there. Then push again. >> >> These commands might be outdated/wrong though. I just dug them up from my >> notes. And there may be more specific ways to run all the test commands. >> But I found this to be simple enough to get things done. Without needing to >> learn a ton about which test targets do what. >> And others may have better suggestions. This is what I felt was simple. >> >> Presumabily these commands will work in the deve environment you refer to. >> >> As for finding the target names, I don't have the best answer here. The >> wiki has some commands for running different types of tests >> "ValidatesRunner", etc. IIRC these require a command with a few arguments. >> If you are just dealing with a basic unit test in Java, I suggest using >> intelliJ to run the test, which will figure out the command for you. >> >> On Mon, Apr 5, 2021 at 10:02 AM Evan Galpin <[email protected]> >> wrote: >> >>> Hey beam devs! Does anyone have any tips for running Beam unit tests and >>> pre-commit checks in the dockerized development environment created by >>> using the shell script in the repo root "start-build-env.sh"? >>> >>> For PreCommit_Java, I can't seem to find a gradle task which corresponds >>> (as compared to spotlessApply task, for example). Is this part of the >>> `check` gradle task? >>> >>> For unit tests (`gradlew test`), I seem to encounter an error with GRPC >>> (Task :model:pipeline:generateProto FAILED) due to permission denied error >>> running an `exe` within the container before running any tests. >>> >>> Any help would be greatly appreciated! >>> >>> Thanks, >>> Evan >>> >>> >>>
