end-to-end/storage/storage.sh
2024-08-07 11:42:22 +02:00

49 lines
1.1 KiB
Bash
Executable file

# SPDX-License-Identifier: MIT
STORAGE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
STORAGE_PATHS="attachments avatars lfs packages repo-archive repo-avatars"
function storage_reset() {
local config=$1
reset_forgejo $STORAGE_DIR/$config-app.ini
reset_minio
reset_garage
}
function verify_storage() {
local work_path=$DIR/forgejo-work-path
for path in ${STORAGE_PATHS}; do
test -d $work_path/data/$path
done
}
function cleanup_storage() {
local work_path=$DIR/forgejo-work-path
for path in ${STORAGE_PATHS}; do
rm -fr $work_path/data/$path
done
}
function test_storage_stable_s3() {
local work_path=$DIR/forgejo-work-path
local s3_backend=${1:-minio}
for version in $RELEASE_NUMBERS_AND_DEV; do
log_info "Forgejo $version & $s3_backend"
stop
storage_reset stable-s3
start $version $s3_backend
fixture_create
for fun in ${STORAGE_FUN}; do
fixture_${fun}_assert_s3
done
done
}
function test_storage() {
run test_storage_stable_s3 minio
run test_storage_stable_s3 garage
}