split storage & ugprade and separate fixtures
This commit is contained in:
parent
bf689a2478
commit
554d2b48c0
20 changed files with 170 additions and 118 deletions
30
upgrade/default-app.ini
Normal file
30
upgrade/default-app.ini
Normal file
|
@ -0,0 +1,30 @@
|
|||
RUN_MODE = prod
|
||||
WORK_PATH = ${WORK_PATH}
|
||||
|
||||
[server]
|
||||
APP_DATA_PATH = ${WORK_PATH}/data
|
||||
HTTP_PORT = 3000
|
||||
SSH_LISTEN_PORT = 2222
|
||||
LFS_START_SERVER = true
|
||||
|
||||
[database]
|
||||
DB_TYPE = sqlite3
|
||||
PATH = ${WORK_PATH}/forgejo.db
|
||||
|
||||
[log]
|
||||
MODE = file
|
||||
LEVEL = trace
|
||||
ROUTER = file
|
||||
|
||||
[log.file]
|
||||
FILE_NAME = forgejo.log
|
||||
|
||||
[security]
|
||||
INSTALL_LOCK = true
|
||||
|
||||
[repository]
|
||||
ENABLE_PUSH_CREATE_USER = true
|
||||
DEFAULT_PUSH_CREATE_PRIVATE = false
|
||||
|
||||
[actions]
|
||||
ENABLED = true
|
35
upgrade/test-upgrade-forgejo-database-v3.sh
Normal file
35
upgrade/test-upgrade-forgejo-database-v3.sh
Normal file
|
@ -0,0 +1,35 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
function test_forgejo_database_version() {
|
||||
local expected_version=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
actual_version=$(sqlite3 $work_path/forgejo.db "select version from forgejo_version")
|
||||
test "$expected_version" = "$actual_version"
|
||||
}
|
||||
|
||||
function test_forgejo_database_v3_upgrades_list_table() {
|
||||
local table=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
sqlite3 $work_path/forgejo.db ".tables $table" .exit | grep --quiet $table
|
||||
}
|
||||
|
||||
function test_forgejo_database_v3_upgrades() {
|
||||
local table=forgejo_auth_token
|
||||
|
||||
stop
|
||||
|
||||
upgrade_reset default
|
||||
log_info "run 1.20.4-1"
|
||||
start 1.20.4-1
|
||||
stop
|
||||
! test_forgejo_database_v3_upgrades_list_table $table
|
||||
test_forgejo_database_version 2
|
||||
|
||||
log_info "run 1.20.5-0"
|
||||
start 1.20.5-0
|
||||
stop
|
||||
test_forgejo_database_v3_upgrades_list_table $table
|
||||
test_forgejo_database_version 3
|
||||
}
|
50
upgrade/upgrade.sh
Executable file
50
upgrade/upgrade.sh
Executable file
|
@ -0,0 +1,50 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
|
||||
UPGRADE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
function upgrade_reset() {
|
||||
local config=$1
|
||||
reset_forgejo $UPGRADE_DIR/$config-app.ini
|
||||
reset_minio
|
||||
}
|
||||
|
||||
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_successful_upgrades() {
|
||||
for config in default ; do
|
||||
log_info "using $config app.ini"
|
||||
upgrade_reset $config
|
||||
|
||||
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 "run $version"
|
||||
cleanup_storage
|
||||
start $version
|
||||
verify_storage
|
||||
stop
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
source $UPGRADE_DIR/test-upgrade-forgejo-database-v3.sh
|
||||
|
||||
function test_upgrades() {
|
||||
run dependencies
|
||||
run build_all
|
||||
|
||||
run test_successful_upgrades
|
||||
run test_forgejo_database_v3_upgrades
|
||||
}
|
Loading…
Add table
Reference in a new issue