end-to-end/storage/storage.sh

57 lines
1.3 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}
log_info "See also https://codeberg.org/forgejo/forgejo/issues/1338"
for version in 1.18 1.19 1.20.2-0 1.20.3-0 1.20 1.21 $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
}
source $STORAGE_DIR/test-upgrade-1.20-storage.sh
function test_storage() {
run test_storage_stable_s3 minio
run test_storage_stable_s3 garage
test_upgrade_1_20_storage
run test_forgejo_database_v3_upgrades
}