bazel-contrib / bazel-contrib/rules_bazel_integration_test

Add some (opt in) mechanism to share `--repository_cache` and `--repo_contents_cache`

Open
#527 5 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Starlark
Stars
65
Forks
16
Avg merge
1d 9h
Merged PRs (30d)
9

Description

I'm using rules_bazel_integration_test quite happily in rules_img, but one issue I'm seeing a lot is rate limiting with various APIs that are accessed in repo rules while running integration tests.

The reason this is happening is the use of `TEST_TMPDIR`, which silos many of Bazel's default paths:

https://github.com/bazelbuild/bazel/blob/5b14d04f6d74f5a7238110b38e1d338879e4a545/src/main/cpp/startup_options.cc#L645-L656

You can also see this in Bazel's logs:

```
$TEST_TMPDIR defined, some defaults will be overridden
...
repository_cache: /home/malte/.cache/bazel/_bazel_malte/cd535aca85f70194fa75f44025138530/sandbox/linux-sandbox/3126/execroot/_main/_tmp/4efa138a8530aba334adcf98db25fa9f/_bazel_malte/cache/repos/v1
...
```

What I would like to do is to add some configuration that allows users to share the repository cache and repo contents cache across integration tests if they like.
This obviously makes tests less hermetic, as some repository rules may use cached results instead of running from scratch, but if that's acceptable for your test case, it can greatly improve test speeds and avoid accidentally hammering public APIs.

Contributor guide

Open the contributing guide

Research direction

Start by tracing how rules_bazel_integration_test sets TEST_TMPDIR and how its integration-test configuration reaches Bazel's repository_cache and repo_contents_cache. Define the opt-in behavior while preserving isolated defaults, then verify the integration tests cover both shared-cache and hermetic modes.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.