Skip to content

Commit

Permalink
Add a test for legacy case
Browse files Browse the repository at this point in the history
  • Loading branch information
sluongng committed Sep 19, 2023
1 parent fff3b9e commit a288067
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/test/shell/bazel/bazel_repository_cache_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -529,4 +529,39 @@ EOF
&& fail "expected failure" || :
}

function test_repository_legacy_default_canonical_id() {
setup_repository

bazel fetch --repository_cache="$repo_cache_dir" \
--norepository_cache_urls_as_default_canonical_id \
//zoo:breeding-program >& $TEST_log \
|| echo "Expected fetch to succeed"

shutdown_server

bazel fetch --repository_cache="$repo_cache_dir" \
--norepository_cache_urls_as_default_canonical_id \
//zoo:breeding-program >& $TEST_log \
|| echo "Expected fetch to succeed"

# Break url in WORKSPACE
rm WORKSPACE
cat >> $(create_workspace_with_default_repos WORKSPACE) <<EOF
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = 'endangered',
url = 'http://localhost:$nc_port/bleh.broken',
sha256 = '$sha256',
type = 'zip',
)
EOF

# As repository cache key should depend on urls, we expect fetching to fail now.
bazel fetch --repository_cache="$repo_cache_dir" \
--norepository_cache_urls_as_default_canonical_id \
//zoo:breeding-program >& $TEST_log \
|| echo "Expected fetch to succeed"
}

run_suite "repository cache tests"

0 comments on commit a288067

Please sign in to comment.