Skip to content

fix(cache): support validated ranged proxy downloads #38

fix(cache): support validated ranged proxy downloads

fix(cache): support validated ranged proxy downloads #38

name: Integration Test
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_DB: cache_test
POSTGRES_USER: cache
POSTGRES_PASSWORD: cache
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U cache -d cache_test"
--health-interval 5s
--health-timeout 5s
--health-retries 20
mysql:
image: mysql:8.4
env:
MYSQL_DATABASE: cache_test
MYSQL_USER: cache
MYSQL_PASSWORD: cache
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping -h 127.0.0.1 -u cache --password=cache"
--health-interval 5s
--health-timeout 5s
--health-retries 30
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Go
uses: actions/setup-go@v7
with:
go-version-file: go.mod
cache: true
- name: Download Go modules
run: go mod download
- name: Start PgBouncer in transaction pooling mode
run: |
sudo apt-get update
sudo apt-get install -y pgbouncer postgresql-client
sudo systemctl stop pgbouncer
cat > "$RUNNER_TEMP/pgbouncer-users.txt" <<'EOF'
"cache" "cache"
EOF
cat > "$RUNNER_TEMP/pgbouncer.ini" <<EOF
[databases]
cache_test = host=127.0.0.1 port=5432 dbname=cache_test user=cache password=cache
[pgbouncer]
listen_addr = 127.0.0.1
listen_port = 6432
auth_type = trust
auth_file = $RUNNER_TEMP/pgbouncer-users.txt
pool_mode = transaction
pidfile = $RUNNER_TEMP/pgbouncer.pid
logfile = $RUNNER_TEMP/pgbouncer.log
EOF
pgbouncer -d "$RUNNER_TEMP/pgbouncer.ini"
for i in {1..30}; do
if PGPASSWORD=cache psql \
"host=127.0.0.1 port=6432 dbname=cache_test user=cache sslmode=disable" \
--no-psqlrc --set=ON_ERROR_STOP=1 --tuples-only --no-align \
--command='SELECT 1' >/dev/null 2>&1; then
exit 0
fi
sleep 1
done
cat "$RUNNER_TEMP/pgbouncer.log"
exit 1
- name: Unit and SQLite e2e tests
run: go test ./...
- name: Build Docker image
run: docker build -t github-actions-cache-server:test .
- name: Start MinIO
run: |
docker run -d --name minio \
-p 9000:9000 \
-e MINIO_ROOT_USER=minioadmin \
-e MINIO_ROOT_PASSWORD=minioadmin \
quay.io/minio/minio:latest server /data
for i in {1..30}; do
if curl -fsS http://127.0.0.1:9000/minio/health/ready; then
exit 0
fi
sleep 2
done
docker logs minio
exit 1
- name: External service integration tests
env:
E2E_POSTGRES_URL: postgres://cache:cache@127.0.0.1:5432/cache_test?sslmode=disable
E2E_PGBOUNCER_URL: "postgres://cache:cache@127.0.0.1:6432/cache_test?sslmode=disable&default_query_exec_mode=exec"
E2E_MYSQL_HOST: 127.0.0.1
E2E_MYSQL_PORT: "3306"
E2E_MYSQL_DATABASE: cache_test
E2E_MYSQL_USER: cache
E2E_MYSQL_PASSWORD: cache
E2E_S3_ENDPOINT_URL: http://127.0.0.1:9000
E2E_S3_BUCKET: cache-test
E2E_S3_CREATE_BUCKET: "true"
AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin
AWS_EC2_METADATA_DISABLED: "true"
run: go test ./e2e -run 'TestExternal((Postgres|MySQL)(FilesystemSaveAndRestore|CacheKeyMatching|CleanupRetention|StorageSizeMigration|CapacityEviction|SchemaMigrationSerialization)|PgBouncerSchemaMigrationSerialization|S3MinIOSaveAndRestore)' -count=1