Skip to content

Commit

Permalink
Test uploading large files to cache
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Dec 10, 2024
1 parent 2fd7bea commit 3c040f1
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 17 deletions.
24 changes: 7 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ jobs:
runs-on: ["self-hosted"]

steps:
- name: Write test file
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
echo "$RUNNER_OS $GITHUB_RUN_ID" > test.txt
cat test.txt
- name: Generate a large test file
run: dd if=/dev/urandom of=large-file.bin bs=1M count=10240

# https://github.com/tespkg/actions-cache
- name: Save actions cache
- name: Save to actions cache
uses: tespkg/actions-cache/save@cba095d7af782a955b8f4fa13396fbf0ab62bd4b # v1.7.1
with:
endpoint: minio
Expand All @@ -28,12 +25,7 @@ jobs:
use-fallback: false
key: test-${{ runner.os }}-${{ github.run_id }}
path: |
test.txt
- name: Remove test file
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
rm test.txt
large-file.bin
# https://github.com/tespkg/actions-cache
- name: Restore actions cache
Expand All @@ -49,11 +41,9 @@ jobs:
use-fallback: false
key: test-${{ runner.os }}-${{ github.run_id }}
path: |
test.txt
restored-file.bin
restore-keys: |
test-${{ runner.os }}-
- name: Verify restored cache
shell: bash --noprofile --norc -eo pipefail -x {0}
run: |
test "$RUNNER_OS $GITHUB_RUN_ID" = "$(<test.txt)"
- name: Verify restored file
run: diff large-file.bin restored-file.bin
67 changes: 67 additions & 0 deletions minio-init/tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
services:
minio:
image: minio/minio:RELEASE.2024-10-29T16-01-48Z
command: server /data --console-address ""
environment:
MINIO_BROWSER: off
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:9000/minio/health/ready']
interval: 5s
timeout: 5s
retries: 5
networks:
- minio-network
volumes:
- minio-data:/data
tmpfs:
- /tmp
# - /data

sut:
image: sut
build: ../
networks:
- minio-network
depends_on:
- minio
tmpfs:
- /tmp
# volumes:
# - ../config:/config:ro
environment:
MINIO_SERVER_URL: http://minio:9000
# These must match the root user credentials on minio
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
ACTIONS_CACHE_SECRET_KEY: GkZe6zWARpbmkrxRYVXgfnDpVr8grto9FPaqB4BZ
YOCTO_CACHE_SECRET_KEY: oDJpKOMNlxiSQ07XxivRFOkzTz3K292xi3WeRUgm
entrypoint:
- /bin/sh
- -c
command:
- |
set -ex
ansible-playbook playbooks/main.yml --inventory /config/inventory.ini
mkdir -p /data/
# generate a +5GB file
dd if=/dev/urandom of=/data/5gb.bin bs=1M count=10240
# upload the file to minio
mc alias set minio http://minio:9000 actions-svcacct "$${ACTIONS_CACHE_SECRET_KEY}"
mc cp /data/5gb.bin minio/actions-cache/
# download the file from minio
mc cp minio/actions-cache/5gb.bin /data/5gb.new
# verify the file is the same
diff /data/5gb.new /data/5gb.bin
volumes:
minio-data: {}

networks:
minio-network: {}

0 comments on commit 3c040f1

Please sign in to comment.