-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option --check_tests_up_to_date doesn't work with Remote cache server #3978
Comments
Not sure if it can help solve the issue, but I took latest master and tracked this back to the method bazel/src/main/java/com/google/devtools/build/lib/runtime/TestResultAnalyzer.java Line 212 in 8601d4a
I might be wrong but I believe the expected behaviour is for it to return true in the case the test was I have zero knowledge on protobuf.. but my wild guess is that this method returns the value from this: bazel/src/main/protobuf/test_status.proto Line 90 in bdb4fe4
Which is missing from the test result data and probably ought to be there. |
Overall, I'm not sure the additional complexity is warranted. On the other hand, we've been considering removing the local action cache in favor of a local spawn cache (for which there is an implementation now), and we probably can't just remove the check_up_to_date and check_tests_up_to_date flags, so we'd need to find a way to implement these flags on top of spawn caches, in which case we might as well make it work in all cases. |
Hi @ulfjack ,
I think anyone using those flags on the local cache will eventually want to be using them on the remote cache.. so either this should be implemented or the flags simply shouldn't exist to avoid this usage pattern? I'm not sure if I could but with some guidance I would be very happy to try to contribute to implementing those flags for the remote cache. |
In case anyone else is trying to do something similar and is blocked by this, I would recommend having a look at querying the graph instead of using the cache. For more info, read this discussion: https://groups.google.com/forum/#!starred/bazel-discuss/FVLLarcC5hA |
I wasn't aware that we had this flag. The general idea seems useful for remote caching / execution to check which actions are not cached remotely (and maybe why). fyi @agoulti |
Hi there! We're doing a clean up of old issues and will be closing this one. Please reopen (or ping me to reopen) if you’d like to discuss anything further. We’ll respond as soon as we have the bandwidth/resources to do so. |
Bazel lacks a method to verify if test results are current in the cache. Additional details can be found at: bazelbuild/bazel#3978. To address this limitation, let's change the test runner so that it doesn't run tests and exits with a non-zero code immediately if the $TEST_CHECK_UP_TO_DATE_FILE file exists. To check test results in the cache, we need to create the $TEST_CHECK_UP_TO_DATE_FILE and run tests. Successful test execution indicates that the results are up-to-date in the cache. Signed-off-by: Andrei Vagin <[email protected]>
Bazel lacks a method to verify if test results are current in the cache. Additional details can be found at: bazelbuild/bazel#3978. To address this limitation, let's change the test runner so that it doesn't run tests and exits with a non-zero code immediately if the $TEST_CHECK_UP_TO_DATE_FILE file exists. To check test results in the cache, we need to create the $TEST_CHECK_UP_TO_DATE_FILE and run tests. Successful test execution indicates that the results are up-to-date in the cache. Signed-off-by: Andrei Vagin <[email protected]>
Description of the bug:
Bazel option
--check_tests_up_to_date
doesn't work with the remote cache server.Also there is no easy way to know if the tests were retrieved from the cache server or if they actually run.
Is this a bug or an intended behavior? Is there any alternative?
Background to the question / context
I have been trying to setup a remote cache server for setting up bazel with jenkins. We have a mono repo with multiple BUILD projects/libs and what I am trying to do is to setup a main jenkins pipeline which would run on every open pull requests and every commits to master. This main pipeline is checking if tests are up to date, if they are not, then we execute a downstream pipeline specific to the project requiring tests. The downstream pipeline run the tests and automatically deploy to staging/dev environments depending on the branch and project.
We need to use the remote cache server because we want the ability to run this pipeline in parallel for every PR. So that we can open 2 PRs at the same time and one doesn't need to wait for the other to run tests. Eventually this will be done from multiple jenkins nodes but for now we simply checkout the code in a different directory for each branches.
This setup works really well with a single server and single branch/workspace since we only need the local cache and the --check_tests_up_to_date works as expected. However this doesn't work when using the remote cache server.
Minimal example to reproduce the problem:
Consider the following repository: https://github.com/dfabulich/hazelcast-junit-test
First start the hazelcast server:
Then run the tests for the first time
All good: We can see that the tests take 10s seconds to execute (this is due to a sleep in the tests)
Then we run the tests for a second time, but do a bazel clean to remove the local cache. Checking out the repo on a different path would do the same:
Good but could be better: We can see that the tests passed but didn't actually run from the fact that tests took 0 seconds. However it doesn't show the usual string
(cached) PASSED
Then doing the same with the argument --check_tests_up_to_date:
Not good: bazel doesn't use the remote cache server and shows NO STATUS .. forcing us to rebuild/retest all of our apps.
Environment info
Operating System:
Linux ubuntu
Bazel version (output of
bazel info release
):release 0.7.0
Have you found anything relevant by searching the web?
This issue was useful for me to understand how the remote cache works: #1413
Small note:
Our actual project is mostly python code, but the behaviour is the same as for this java unit test.
The text was updated successfully, but these errors were encountered: