minio/minio
Testing
MinIO has a layered test setup: Go unit tests next to each source file, and a large suite of shell-driven end-to-end tests that boot real minio servers and drive them with mc.
Unit tests
make testBehind the scenes:
make verifiers # lint + check-gen
make build # produces ./minio (used by some tests)
MINIO_API_REQUESTS_MAX=10000 CGO_ENABLED=0 go test -v -tags kqueue,dev ./...- Build tags
kqueue,devenable the cross-platform kqueue poller emulation anddevmode (extra assertions, dummy KMS keys). MINIO_API_REQUESTS_MAX=10000raises the per-server request cap so concurrent tests don't get throttled.CGO_ENABLED=0keeps tests pure Go; flip to1only for race tests.
To run a single test:
go test -tags kqueue,dev -run TestPutObject ./cmdTo run only the IAM tests:
make test-iamRace tests
make test-raceThis invokes buildscripts/race.sh, which sets GORACE=history_size=7 CGO_ENABLED=1 -race and runs the suite. Race tests are slower and require a working C toolchain.
Test fixtures and helpers
cmd/test-utils_test.go— the shared harness: stand up an in-process server, build mock requests, sign them.cmd/naughty-disk_test.go— aStorageAPIwrapper that lets a test inject errors into specific drive operations. Used by healing and replication tests.cmd/dummy-data-generator_test.go— deterministic payload generation for size and hash assertions.cmd/benchmark-utils_test.go— Go benchmark helpers reused byBenchmarkXxxtests.
End-to-end tests
The bulk of the integration coverage lives in shell scripts that boot minio (or several minio instances) and run mc. The Makefile exposes them as targets:
| Target | Underlying script |
|---|---|
make verify |
buildscripts/verify-build.sh |
make verify-healing |
buildscripts/verify-healing.sh |
make verify-healing-with-root-disks |
buildscripts/verify-healing-with-root-disks.sh |
make verify-healing-with-rewrite |
buildscripts/rewrite-old-new.sh |
make verify-healing-inconsistent-versions |
buildscripts/resolve-right-versions.sh |
make test-replication |
docs/bucket/replication/setup_*site_*replication.sh |
make test-site-replication-{ldap,oidc,minio} |
docs/site-replication/run-multi-site-*.sh |
make test-decom |
docs/distributed/decom*.sh |
make test-versioning |
docs/bucket/versioning/versioning-tests.sh |
make test-ilm |
docs/bucket/replication/setup_ilm_expiry_replication.sh |
make test-ilm-transition |
docs/bucket/lifecycle/setup_ilm_transition.sh |
make test-iam |
go test -run TestIAM* ./cmd and make test-iam-ldap-* |
make test-iam-import-with-missing-entities |
docs/distributed/iam-import-with-missing-entities.sh |
make test-pbac |
docs/iam/policies/pbac-tests.sh |
make test-multipart |
buildscripts/multipart-quorum-test.sh |
make test-timeout |
buildscripts/test-timeout.sh |
make test-resiliency |
docs/resiliency/resiliency-tests.sh (docker-compose-driven) |
make test-upgrade |
buildscripts/minio-upgrade.sh |
make test-configfile |
docs/distributed/distributed-from-config-file.sh |
These scripts assume mc, minio (built via make install-race), curl, and a writable /tmp are available. Many also assume the host has multiple CPU cores and at least a few GB of free RAM.
Resiliency (Docker)
make test-resiliencyBoots a full distributed cluster via docs/resiliency/docker-compose.yaml and runs failure-injection scenarios that drop nodes, drives, and partitions while traffic flows.
What to test for a new change
| Type of change | Minimum test coverage |
|---|---|
| New S3 verb / handler | Go unit test in cmd/object-handlers_test.go or sibling |
| New admin endpoint | Go unit test in cmd/admin-handlers_test.go |
| Erasure / xl-storage change | Race-instrumented test using naughtyDisk for failure injection |
| Replication change | One of test-replication-2site / test-replication-3site |
| IAM/STS change | TestIAM* Go tests + test-iam-import-* scripts |
| ILM / lifecycle change | make test-ilm and/or make test-ilm-transition |
| Format-on-disk change | Add a migration in cmd/xl-storage-format-v2-legacy.go-style and a regression test |
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.