@@ -2062,6 +2062,65 @@ EOF
2062
2062
fi
2063
2063
}
2064
2064
2065
+ function test_retry_build_if_remote_executor_is_unavailable() {
2066
+ mkdir -p a
2067
+
2068
+ cat > a/BUILD << 'EOF '
2069
+ genrule(
2070
+ name = 'foo',
2071
+ srcs = ['foo.in'],
2072
+ outs = ['foo.out'],
2073
+ cmd = 'cat $(SRCS) > $@',
2074
+ )
2075
+
2076
+ genrule(
2077
+ name = 'bar',
2078
+ srcs = ['foo.out', 'bar.in'],
2079
+ outs = ['bar.out'],
2080
+ cmd = 'cat $(SRCS) > $@',
2081
+ tags = ['no-remote-exec'],
2082
+ )
2083
+ EOF
2084
+
2085
+ echo foo > a/foo.in
2086
+ echo bar > a/bar.in
2087
+
2088
+ # Populate remote cache
2089
+ bazel build \
2090
+ --remote_executor=grpc://localhost:${worker_port} \
2091
+ --remote_download_minimal \
2092
+ //a:bar >& $TEST_log || fail " Failed to build"
2093
+
2094
+ bazel clean
2095
+
2096
+ # Clean build, foo.out isn't downloaded
2097
+ bazel build \
2098
+ --remote_executor=grpc://localhost:${worker_port} \
2099
+ --remote_download_minimal \
2100
+ //a:bar >& $TEST_log || fail " Failed to build"
2101
+
2102
+ if [[ -f bazel-bin/a/foo.out ]]; then
2103
+ fail " Expected intermediate output bazel-bin/a/foo.out to not be downloaded"
2104
+ fi
2105
+
2106
+ # Make the remote worker unavailable
2107
+ stop_worker
2108
+ start_worker --unavailable
2109
+
2110
+ echo " updated bar" > a/bar.in
2111
+
2112
+ # Incremental build triggers remote cache error but Bazel automatically retries the build and reruns the generating
2113
+ # actions locally for missing blobs
2114
+ bazel build \
2115
+ --remote_executor=grpc://localhost:${worker_port} \
2116
+ --remote_local_fallback \
2117
+ --remote_download_minimal \
2118
+ --experimental_remote_cache_eviction_retries=1 \
2119
+ //a:bar >& $TEST_log || fail " Failed to build"
2120
+
2121
+ expect_log " Found transient remote cache error, retrying the build..."
2122
+ }
2123
+
2065
2124
function test_remote_cache_eviction_retries_toplevel_artifacts() {
2066
2125
mkdir -p a
2067
2126
0 commit comments