Building and testing #
Build #
make localbuild # bin/IceFireDB for the host platform
make run # go run . (development)
make run_dev # same, for a dev setup
make clean # remove bin/ and installed copies
Release and cross-compilation targets exist (make all, make release, make build-linux-*), but while
iterating on the code use run/localbuild — the release matrix builds five GOOS/GOARCH variants per
invocation.
The binary embeds its git revision and build time:
go build -ldflags "-X main.BuildVersion=$(git rev-parse --short HEAD) -X main.BuildDate=$(date '+%F %T')" -o bin/IceFireDB .
-h shows the version and, when BuildVersion is set, includes it in the banner.
Test suites #
| Command | What it runs |
|---|---|
make test / go test ./... | Unit tests, honouring DRIVER |
DRIVER=goleveldb make test-compat | RESP compatibility suite, -tags alltest |
make test-integration | Builds the binary, then crash-recovery and multi-node Raft failover tests (-tags integration) |
make test-partition | Docker-based split-brain test: 3 nodes, leader cut off the network (-tags partition) |
make soak | Sustained load against a 3-node cluster; SOAK_DURATION, SOAK_WORKERS, SOAK_CHAOS=1 |
DRIVER selects the storage backend the tests exercise (badger is the Makefile default):
DRIVER=badger make test
DRIVER=goleveldb make test-compat
DRIVER=hybriddb go test ./driver/hybriddb/...
Some drivers need infrastructure before their tests can run:
| Driver | Requirement |
|---|---|
oss | S3-compatible endpoint; CI starts LocalStack and sets OSS_TEST_ENDPOINT |
ipfs, ipfs-synckv | IPFS daemon at --ipfs-endpoint |
crdt, ipfs-log | libp2p connectivity between test nodes |
What CI runs #
.github/workflows/test.yml runs the alltest suite once per driver — oss, ipfs, ipfs-synckv,
goleveldb, crdt, ipfs-log, badger, hybriddb — plus driver-specific packages and the SQLite
suite. The oss job uses LocalStack (MinIO’s public image no longer pulls anonymously).
.github/workflows/build.yml builds the five release targets, so a change that only compiles on amd64
does not sneak through.
Both workflows pin the toolchain the module declares: go 1.26.0 with toolchain go1.27.3, and CI runs
Go 1.27.3. A local go older than that will fail on the module’s toolchain directive rather than
on the code.
Writing a test for a command #
//go:build alltest
package main
import (
"context"
"testing"
)
func TestMyCommandContract(t *testing.T) {
c := getTestConn() // helper used by the compat suite
ctx := context.Background()
// 1. the happy path
// 2. the boundary the handler is supposed to enforce
// 3. the reply type, not just the value
_ = c
_ = ctx
}
The compatibility suite is the right place for anything that pins a divergence from Redis, because
compat_test.go is the document those divergences point at.
Static checks worth running by hand #
go vet ./...
gofmt -l . # expect no output outside vendor/
go mod tidy && go mod vendor # after touching go.mod
Note that go mod vendor rewrites the vendor/ tree — the Raft/RESP layer and ledis live there, so a
vendor update is a code review, not a formality.