Skip to content

Commit d0291cd

Browse files
test: add container-based OOM proof test
Run s3proxy in a 128MB memory-constrained container and hammer it with concurrent large uploads. If the memory limiter fails, the kernel OOM-kills the process (exit code 137) — a binary pass/fail. - Add s3proxy service to docker-compose with mem_limit=128m (oom profile) - Add test_memory_leak.py with PUT and multipart upload stress tests - Add make test-oom target and CI step
1 parent 300f9a4 commit d0291cd

File tree

4 files changed

+384
-2
lines changed

4 files changed

+384
-2
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
jobs:
1414
tests:
1515
runs-on: ubuntu-latest
16-
timeout-minutes: 15
16+
timeout-minutes: 30
1717
steps:
1818
- uses: actions/checkout@v6
1919

@@ -31,3 +31,6 @@ jobs:
3131

3232
- name: Run all tests
3333
run: make test-all
34+
35+
- name: OOM proof test (128MB container)
36+
run: make test-oom

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: test test-all test-unit test-run test-memory-bounds e2e cluster lint
1+
.PHONY: test test-all test-unit test-run test-oom e2e cluster lint
22

33
# Lint: ruff check + format check
44
lint:
@@ -33,6 +33,17 @@ test-run:
3333
docker compose -f tests/docker-compose.yml down; \
3434
exit $$EXIT_CODE
3535

36+
# OOM proof test: runs s3proxy in a 128MB container and hammers it
37+
test-oom:
38+
@docker compose -f tests/docker-compose.yml --profile oom down 2>/dev/null || true
39+
@docker compose -f tests/docker-compose.yml --profile oom up -d --build
40+
@sleep 5
41+
@AWS_ACCESS_KEY_ID=minioadmin AWS_SECRET_ACCESS_KEY=minioadmin \
42+
uv run pytest -v tests/integration/test_memory_leak.py; \
43+
EXIT_CODE=$$?; \
44+
docker compose -f tests/docker-compose.yml --profile oom down; \
45+
exit $$EXIT_CODE
46+
3647
# E2E cluster commands
3748
e2e:
3849
./e2e/cluster.sh $(filter-out $@,$(MAKECMDGOALS))

tests/docker-compose.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,23 @@ services:
1515
MINIO_ROOT_USER: minioadmin
1616
MINIO_ROOT_PASSWORD: minioadmin
1717
command: server /data --console-address ":9001"
18+
19+
s3proxy:
20+
profiles: ["oom"]
21+
build:
22+
context: ../
23+
dockerfile: Dockerfile
24+
container_name: s3proxy-test-server
25+
mem_limit: 128m
26+
ports:
27+
- "4433:4433"
28+
environment:
29+
S3PROXY_ENCRYPT_KEY: "test-encryption-key-32-bytes!!"
30+
S3PROXY_HOST: "http://minio:9000"
31+
S3PROXY_REGION: "us-east-1"
32+
S3PROXY_MEMORY_LIMIT_MB: "16"
33+
S3PROXY_LOG_LEVEL: "WARNING"
34+
AWS_ACCESS_KEY_ID: minioadmin
35+
AWS_SECRET_ACCESS_KEY: minioadmin
36+
depends_on:
37+
- minio

0 commit comments

Comments
 (0)