Skip to content

Commit ee3b481

Browse files
authored
Test that bazel_binaries.download matches .bazelversion (#47)
We're already testing our `.bazelversion` files are consistent. We should make sure the Bazel binary we're running our integration tests is consistent as well.
1 parent 5091cf7 commit ee3b481

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/version/bazel_version_test.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,19 @@ set -eufo pipefail
55
WORKING_DIRECTORY="${1}"
66

77
ROOT_BAZEL_VERSION="${WORKING_DIRECTORY}/.bazelversion"
8+
ROOT_BAZEL_MODULE="${WORKING_DIRECTORY}/MODULE.bazel"
89

910
BAZEL_VERSIONS=$(find "${WORKING_DIRECTORY}" -name .bazelversion)
1011

1112
for BAZEL_VERSION in ${BAZEL_VERSIONS}; do
1213
cmp -b "${ROOT_BAZEL_VERSION}" "${BAZEL_VERSION}"
1314
done
1415

16+
if ! grep -q "bazel_binaries.download(version = \"$(cat "${ROOT_BAZEL_VERSION}")\")" "${ROOT_BAZEL_MODULE}"; then
17+
echo "${ROOT_BAZEL_MODULE} 'bazel_binaries.download' version doesn't match .bazelversion"
18+
echo "Expected: bazel_binaries.download(version = \"$(cat "${ROOT_BAZEL_VERSION}")\")"
19+
echo "Found: $(grep -E "^bazel_binaries.download" "${ROOT_BAZEL_MODULE}")"
20+
exit 1
21+
fi
22+
1523
echo "All .bazelversion files are identical"

0 commit comments

Comments
 (0)