Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 2 additions & 51 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
matrix:
# Every module has its own go.mod and is linted independently. Keep
# this in step with MODULES in the Makefile.
module: [".", "lfu", "policies", "policies/arc", "policies/fifo", "policies/tinylfu", "metrics", "bandit", "bandit/redis", "benchclient", "bench", "examples/basic", "examples/migration"]
module: [".", "lfu", "policies", "policies/arc", "policies/fifo", "policies/tinylfu", "metrics", "bandit", "benchclient", "bench", "examples/basic", "examples/migration"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand All @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
module: [".", "lfu", "policies", "policies/arc", "policies/fifo", "policies/tinylfu", "metrics", "bandit", "bandit/redis", "benchclient", "bench", "examples/basic", "examples/migration"]
module: [".", "lfu", "policies", "policies/arc", "policies/fifo", "policies/tinylfu", "metrics", "bandit", "benchclient", "bench", "examples/basic", "examples/migration"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
Expand Down Expand Up @@ -84,52 +84,3 @@ jobs:
cache-dependency-path: go.sum
# Reads each go.mod through `go mod edit -json`, so no network is needed.
- run: ./scripts/release-check.sh

# The test job above runs bandit/redis against miniredis, which is a fake.
# This one runs the same suite against real servers, because the adapter
# leans on three things a fake can be too permissive about: TIME called
# inside a Lua script, SET with NX and PX, and HINCRBY on a key the script
# names itself rather than declaring in KEYS.
#
# Both engines run, because both are documented as supported. Testing one
# while documenting two is how that claim quietly stops being true. This is
# the CI equivalent of `make redis-test`; docker-compose.yml is the local one.
redis:
name: test bandit/redis (${{ matrix.engine.name }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
engine:
# Deriving the bucket from the server's clock inside a script needs
# effects replication, so the floor is Redis 7 / Valkey 7.2.
- name: valkey 8
image: valkey/valkey:8-alpine
ping: valkey-cli ping
- name: redis 7
image: redis:7-alpine
ping: redis-cli ping
services:
server:
image: ${{ matrix.engine.image }}
ports:
- 6379:6379
options: >-
--health-cmd "${{ matrix.engine.ping }}"
--health-interval 1s
--health-timeout 3s
--health-retries 20
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.25"
cache-dependency-path: bandit/redis/go.sum
- name: go test
working-directory: bandit/redis
# Set, so the suite uses the service container rather than miniredis.
# The suite fails rather than skips if this address is unreachable, so
# a broken service container cannot pass as a green fake run.
env:
AS_CACHE_REDIS_ADDR: 127.0.0.1:6379
run: go test -race -count=1 ./...
29 changes: 1 addition & 28 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Each of these directories is a separate Go module (own go.mod), so tooling is
# run once per module. The root .golangci.yml is shared by all of them.
MODULES := . lfu policies policies/arc policies/fifo policies/tinylfu metrics bandit bandit/redis benchclient bench examples/basic examples/migration
MODULES := . lfu policies policies/arc policies/fifo policies/tinylfu metrics bandit benchclient bench examples/basic examples/migration

GOLANGCI_LINT_VERSION := v2.8.0

Expand Down Expand Up @@ -50,33 +50,6 @@ release-check: ## Check the repository could actually be released today
evidence: ## Replay the workload suite and print the policy comparison tables
( cd bench && go test -count=1 -timeout 20m -v ./... )

# The bandit/redis tests run against miniredis by default, which is a fake.
# The Lua the adapter depends on - TIME inside a script, SET NX PX, HINCRBY on
# a key the script names itself - is exactly what a fake can be too permissive
# about, so the same suite runs against real servers here. See
# docker-compose.yml for why both engines are covered rather than one.
COMPOSE ?= docker compose

.PHONY: redis-up
redis-up: ## Start the local Valkey and Redis containers and wait for them
$(COMPOSE) up -d --wait

.PHONY: redis-down
redis-down: ## Stop the local Valkey and Redis containers
$(COMPOSE) down -v

.PHONY: redis-test
redis-test: ## Run the bandit/redis suite against real Valkey and Redis
@$(MAKE) redis-up
@status=0; \
for target in "valkey 127.0.0.1:63799" "redis 127.0.0.1:63798"; do \
set -- $$target; \
echo "==> bandit/redis against $$1 ($$2)"; \
( cd bandit/redis && AS_CACHE_REDIS_ADDR=$$2 go test -race -count=1 ./... ) || status=1; \
done; \
$(MAKE) redis-down; \
exit $$status

.PHONY: tidy
tidy: ## Run go mod tidy across all modules
@set -e; for m in $(MODULES); do \
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ been exercised under the race detector and adversarially reviewed. It is all in
| [Configuration](docs/configuration.md) | Every `Settings` field, migration strategies, sampling, stability gates, tuning |
| [Policies](docs/policies.md) | The nine ready-made arms, their caveats, adapting your own cache |
| [Advisor mode](docs/advisor-mode.md) | `ObserveOnly`, `Advice()`, and the `metrics` module |
| [Evidence](docs/evidence.md) | Every measured claim: policy tables, competing libraries, real traces, sampling fidelity, fleets |
| [Evidence](docs/evidence.md) | Every measured claim: policy tables, competing libraries, real traces, sampling fidelity |
| [Benchmarking](docs/benchmarking.md) | Reproducible replays, `benchclient`, `make evidence` |
| [Running a fleet](docs/fleet.md) | Pooling evidence across replicas through Valkey or Redis |
| [Project site](https://sshaplygin.github.io/as-cache/) | Landing page, plus an interactive explorer of the bandit's decisions on a phase-shift run |

Past releases are recorded in the [changelog](CHANGELOG.md) and on the
Expand Down
Loading
Loading