I'm running E2E test using some bazel test target (the scala flavour of java_test
).
In Maven I used to dump logs to target/logs
folder that was created during test time, and then if something failed - I could have looked in this folder and find the logs.
In bazel - what path can I put in my test logs configuration so it would be writable and conveniently available upon test finish / test failure?
I know that the java.io.tmp
dir is writable but gets deleted immediately after test finishes.
The tests runner can work on multiple test targets defined by rules. Bazel provides an parallelization system which allows multiple jobs at the same time to be executed.
To run Bazel, go to your base workspace directory or any of its subdirectories and type bazel .
Path: . bazelrc in your workspace directory (next to the main WORKSPACE file).
So digging through bazel docs I found this: https://docs.bazel.build/versions/master/test-encyclopedia.html#initial-conditions
Seems like I can read env variable "TEST_UNDECLARED_OUTPUTS_DIR"
and it will give me a writable path. Anything I write there would be zipped and saved under ./bazel-out/darwin-fastbuild/testlogs/<package-name>/<target-name>/test.outputs/outputs.zip
Pretty cool!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With