Merge pull request 'run upgrades on the development version' (#103) from twenty-panda/end-to-end:wip-cidr into main
Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/103 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
This commit is contained in:
commit
d7e067b418
8 changed files with 337 additions and 277 deletions
|
@ -18,7 +18,7 @@ as:
|
|||
|
||||
```json
|
||||
{
|
||||
"insecure-registries": [ "10.80.4.76:3000" ]
|
||||
"insecure-registries": [ "10.0.0.0/8" ]
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
@ -9,24 +9,25 @@ SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
version=$1
|
||||
DIR=$2
|
||||
|
||||
v=$(echo $version | sed -E -e 's/([0-9]+\.[0-9]+).*/\1/')
|
||||
v=$(echo $version | sed -E -e 's/^([0-9]+\.[0-9]+).*/\1/')
|
||||
read url ref semver < $SELF_DIR/sources/$v
|
||||
|
||||
rm -fr $DIR/src
|
||||
if [[ "$ref" =~ ^refs/ ]] ; then
|
||||
git clone --depth 1 $url $DIR/src
|
||||
if ! test -d $DIR/src ; then
|
||||
mkdir -p $DIR/src
|
||||
cd $DIR/src
|
||||
git fetch origin +$ref:$ref
|
||||
git checkout -b $v $ref
|
||||
git init
|
||||
git remote add origin $url
|
||||
else
|
||||
git clone --depth 1 -b $ref $url $DIR/src
|
||||
cd $DIR/src
|
||||
fi
|
||||
export TAGS="bindata sqlite sqlite_unlock_notify"
|
||||
|
||||
if ! [[ "$ref" =~ ^refs/ ]] ; then
|
||||
ref=refs/heads/$ref
|
||||
fi
|
||||
git fetch --update-head-ok origin +$ref:$ref
|
||||
git switch --force-create $v $ref
|
||||
|
||||
export TAGS="bindata sqlite sqlite_unlock_notify" FORGEJO_VERSION=$semver
|
||||
make deps-backend backend
|
||||
#
|
||||
# use the gitea target here so that branches that do not contain the commit that adds
|
||||
# the `forgejo` target to the Makefile can build successfully
|
||||
#
|
||||
make VERSION=v$version GITEA_VERSION=v$version FORGEJO_VERSION=$semver generate gitea
|
||||
mv gitea $DIR/forgejo-$version
|
||||
make generate forgejo
|
||||
cp -a forgejo $DIR/forgejo-$v-dev
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
https://codeberg.org/forgejo/forgejo v1.20/forgejo 5.0.0+0-gitea-1.20.0
|
|
@ -1 +0,0 @@
|
|||
https://codeberg.org/forgejo/forgejo v1.21/forgejo 6.0.0+0-gitea-1.21.0
|
|
@ -12,11 +12,29 @@ function fixture_get_paths_s3() {
|
|||
local path=$1
|
||||
|
||||
(
|
||||
echo -n $path/
|
||||
mc ls --quiet --recursive testS3/$path | sed -e 's/.* //'
|
||||
mc ls --quiet --recursive testS3/$path | sed -e "s|.* |$path/|"
|
||||
) > $DIR/path
|
||||
}
|
||||
|
||||
function fixture_content_search_s3() {
|
||||
local path="$1"
|
||||
local expected="$2"
|
||||
|
||||
fixture_get_paths_s3 $path
|
||||
if test $(wc -l < $DIR/path) -lt 1 ; then
|
||||
echo expected at least one but got "'$(cat $DIR/path)'"
|
||||
return 1
|
||||
fi
|
||||
for filename in $(cat $DIR/path) ; do
|
||||
local content=$(mc cat testS3/$filename | base64 -w0)
|
||||
if test "$content" = "$expected" ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
echo nothing in $path found with the expected content "$expected"
|
||||
return 1
|
||||
}
|
||||
|
||||
function fixture_get_paths_local() {
|
||||
local path=$1
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
@ -101,9 +119,7 @@ function fixture_avatars_create() {
|
|||
}
|
||||
|
||||
function fixture_avatars_assert_s3() {
|
||||
local filename=$(fixture_get_one_path s3 forgejo/avatars)
|
||||
local content=$(mc cat testS3/$filename | base64 -w0)
|
||||
test "$content" = "$ONEPIXEL"
|
||||
fixture_content_search_s3 forgejo/avatars "$ONEPIXEL"
|
||||
}
|
||||
|
||||
function fixture_avatars_assert_local() {
|
||||
|
|
223
forgejo/upgrades/test-upgrade-1.20-storage.sh
Normal file
223
forgejo/upgrades/test-upgrade-1.20-storage.sh
Normal file
|
@ -0,0 +1,223 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
function test_downgrade_1.20.2_fails() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "downgrading from 1.20.3-0 to 1.20.2-0 fails"
|
||||
stop
|
||||
reset default
|
||||
start 1.20.3-0
|
||||
stop
|
||||
download 1.20.2-0
|
||||
timeout 60 $DIR/forgejo-1.20.2-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
if ! grep --fixed-strings --quiet 'use the newer database' $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_bug_storage_merged() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "using < 1.20.3-0 and [storage].PATH merge all storage"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset merged
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
! test -d $work_path/data/$path
|
||||
done
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
! test -d $work_path/merged/$path
|
||||
done
|
||||
test -d $work_path/merged
|
||||
done
|
||||
stop
|
||||
|
||||
log_info "upgrading from 1.20.2-0 with [storage].PATH fails"
|
||||
download 1.20.3-0
|
||||
timeout 60 $DIR/forgejo-1.20.3-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
if ! grep --fixed-strings --quiet '[storage].PATH is set and may create storage issues' $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_bug_storage_relative_path() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "using < 1.20.3-0 legacy [server].XXXX and [picture].XXXX are relative to WORK_PATH"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset legagy-relative
|
||||
start $version
|
||||
test -d $work_path/relative-lfs
|
||||
test -d $work_path/relative-avatars
|
||||
test -d $work_path/relative-repo-avatars
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 legacy [server].XXXX and [picture].XXXX are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset legagy-relative
|
||||
start $version
|
||||
test -d $work_path/data/relative-lfs
|
||||
test -d $work_path/data/relative-avatars
|
||||
test -d $work_path/data/relative-repo-avatars
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 relative [storage.XXXX].PATHS are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
log_info "using 1.20.[12]-0 relative [storage.XXXX].PATHS are inconsistent"
|
||||
for version in 1.20.2-0 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
test -d $work_path/data/packages
|
||||
test -d $work_path/relative-repo-archive
|
||||
test -d $work_path/relative-attachments
|
||||
test -d $work_path/relative-lfs
|
||||
test -d $work_path/data/avatars
|
||||
test -d $work_path/data/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20 relative [storage.XXXX].PATHS are inconsistent"
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
test -d $work_path/relative-packages
|
||||
test -d $work_path/relative-repo-archive
|
||||
test -d $work_path/relative-attachments
|
||||
test -d $work_path/data/lfs
|
||||
test -d $work_path/data/avatars
|
||||
test -d $work_path/data/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20.3-0 relative [XXXX].PATHS are relative to WORK_PATH"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 relative [XXXX].PATHS are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
stop
|
||||
}
|
||||
|
||||
function test_bug_storage_s3_misplace() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
local s3_backend=${2:-minio}
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/issues/1338"
|
||||
|
||||
for version in 1.20.2-0 1.20.3-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
reset misplace-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
for fun in ${STORAGE_FUN} ; do
|
||||
fixture_${fun}_assert_s3
|
||||
done
|
||||
done
|
||||
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
reset misplace-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
#
|
||||
# some storage are in S3
|
||||
#
|
||||
fixture_attachments_assert_s3
|
||||
fixture_lfs_assert_s3
|
||||
#
|
||||
# others are in local
|
||||
#
|
||||
fixture_repo_archive_assert_local elsewhere/repo-archive
|
||||
fixture_avatars_assert_local elsewhere/avatars
|
||||
fixture_packages_assert_local elsewhere/packages
|
||||
fixture_repo_avatars_assert_local elsewhere/repo-avatars
|
||||
done
|
||||
}
|
||||
|
||||
function test_bug_storage_misplace() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "using < 1.20 and conflicting sections misplace storage"
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
stop
|
||||
reset misplace
|
||||
start $version
|
||||
#
|
||||
# some storage are where they should be
|
||||
#
|
||||
test -d $work_path/data/packages
|
||||
test -d $work_path/data/repo-archive
|
||||
test -d $work_path/data/attachments
|
||||
#
|
||||
# others are under APP_DATA_PATH
|
||||
#
|
||||
test -d $work_path/elsewhere/lfs
|
||||
test -d $work_path/elsewhere/avatars
|
||||
test -d $work_path/elsewhere/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20.[12]-0 and conflicting sections ignores [storage.*]"
|
||||
for version in 1.20.2-0 ; do
|
||||
stop
|
||||
reset misplace
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/elsewhere/$path
|
||||
done
|
||||
done
|
||||
|
||||
stop
|
||||
|
||||
log_info "upgrading from 1.20.2-0 with conflicting sections fails"
|
||||
download 1.20.3-0
|
||||
timeout 60 $DIR/forgejo-1.20.3-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
if ! grep --fixed-strings --quiet "[storage.$path] may conflict" $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function test_upgrade_1_20_storage() {
|
||||
run test_bug_storage_misplace
|
||||
run test_bug_storage_merged
|
||||
run test_downgrade_1.20.2_fails
|
||||
run test_bug_storage_s3_misplace
|
||||
}
|
28
forgejo/upgrades/test-upgrade-forgejo-database-v3.sh
Normal file
28
forgejo/upgrades/test-upgrade-forgejo-database-v3.sh
Normal file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
}
|
|
@ -4,13 +4,18 @@
|
|||
#
|
||||
# Debug loop from the source tree:
|
||||
#
|
||||
# ./.forgejo/upgrades/test-upgrade.sh dependencies
|
||||
# ./.forgejo/upgrades/test-upgrade.sh build_all
|
||||
# VERBOSE=true ./.forgejo/upgrades/test-upgrade.sh test_downgrade_1.20.2_fails
|
||||
# ./forgejo/upgrades/test-upgrade.sh dependencies
|
||||
# ./forgejo/upgrades/test-upgrade.sh build_all
|
||||
# VERBOSE=true ./forgejo/upgrades/test-upgrade.sh test_downgrade_1.20.2_fails
|
||||
#
|
||||
# Everything happens in /tmp/forgejo-upgrades
|
||||
#
|
||||
|
||||
#
|
||||
# Forgejo releases for which a branch exists (7.0/forgejo etc.)
|
||||
#
|
||||
RELEASE_NUMBERS="7.0"
|
||||
|
||||
PREFIX===============
|
||||
HOST_PORT=0.0.0.0:3000
|
||||
STORAGE_PATHS="attachments avatars lfs packages repo-archive repo-avatars"
|
||||
|
@ -26,6 +31,7 @@ SELF_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|||
: ${FORGEJO_USER:=root}
|
||||
: ${FORGEJO_REPO:=fixture}
|
||||
: ${FORGEJO_PASSWORD:=admin1234}
|
||||
RELEASE_NUMBERS_AND_DEV="$(for r in $RELEASE_NUMBERS ; do echo -n $r $r-dev ; done)"
|
||||
|
||||
source $SELF_DIR/fixtures.sh
|
||||
|
||||
|
@ -65,8 +71,10 @@ function dependencies() {
|
|||
}
|
||||
|
||||
function build_all() {
|
||||
log_info 7.0.0-dev
|
||||
$SELF_DIR/../build.sh 7.0.0-dev $DIR
|
||||
for dev in $RELEASE_NUMBERS ; do
|
||||
log_info $dev-dev
|
||||
$SELF_DIR/../build.sh $dev $DIR
|
||||
done
|
||||
}
|
||||
|
||||
function retry() {
|
||||
|
@ -87,16 +95,40 @@ function retry() {
|
|||
fi
|
||||
}
|
||||
|
||||
function full_version() {
|
||||
local version=$1
|
||||
local owner=$2
|
||||
|
||||
if [[ $version =~ ^[0-9]+\.[0-9]+$ ]] ; then
|
||||
full_version=$(curl -sS https://codeberg.org/api/v1/repos/$owner/forgejo/releases | jq -r '.[] | .tag_name | select(startswith("v'$version'"))' | sort -r | head -1)
|
||||
echo ${full_version#v}
|
||||
else
|
||||
echo $version
|
||||
fi
|
||||
}
|
||||
|
||||
function download() {
|
||||
local version=$1
|
||||
|
||||
if ! test -f $DIR/forgejo-$version ; then
|
||||
mkdir -p $DIR
|
||||
for owner in forgejo forgejo-experimental forgejo-integration ; do
|
||||
if wget -O $DIR/forgejo-$version --quiet https://codeberg.org/$owner/forgejo/releases/download/v$version/forgejo-$version-linux-amd64 ; then
|
||||
full_version=$(full_version $version $owner)
|
||||
if test "$full_version" = "" ; then
|
||||
continue
|
||||
fi
|
||||
if wget -O $DIR/forgejo-$version --quiet https://codeberg.org/$owner/forgejo/releases/download/v$full_version/forgejo-$full_version-linux-amd64 ; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
if test -s $DIR/forgejo-$version ; then
|
||||
if test "$version" != "$full_version" ; then
|
||||
log_info "downloaded $full_version for $version"
|
||||
fi
|
||||
else
|
||||
echo unable to download Forgejo $version
|
||||
return 1
|
||||
fi
|
||||
chmod +x $DIR/forgejo-$version
|
||||
fi
|
||||
}
|
||||
|
@ -119,8 +151,8 @@ function start_forgejo() {
|
|||
local work_path=$DIR/forgejo-work-path
|
||||
daemon --chdir=$DIR --unsafe --env="TERM=$TERM" --env="HOME=$HOME" --env="PATH=$PATH" --pidfile=$DIR/forgejo-pid --errlog=$DIR/forgejo-err.log --output=$DIR/forgejo-out.log -- $DIR/forgejo-$version --config $work_path/app.ini --work-path $work_path
|
||||
if ! retry grep 'Starting server on' $work_path/log/forgejo.log ; then
|
||||
cat $DIR/*.log
|
||||
cat $work_path/log/*.log
|
||||
grep '' $DIR/*.log
|
||||
grep '' $work_path/log/*.log 2> /dev/null
|
||||
return 1
|
||||
fi
|
||||
create_user $version
|
||||
|
@ -208,7 +240,7 @@ function create_user() {
|
|||
local cli="$DIR/forgejo-$version --config $work_path/app.ini --work-path $work_path"
|
||||
$cli admin user create --admin --username "$FORGEJO_USER" --password "$FORGEJO_PASSWORD" --email "$FORGEJO_USER@example.com"
|
||||
local scopes="--scopes all"
|
||||
if echo $version | grep --quiet 1.18. ; then
|
||||
if echo $version | grep --quiet 1.18 ; then
|
||||
scopes=""
|
||||
fi
|
||||
|
||||
|
@ -303,180 +335,13 @@ function cleanup_storage() {
|
|||
done
|
||||
}
|
||||
|
||||
function test_downgrade_1.20.2_fails() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "downgrading from 1.20.3-0 to 1.20.2-0 fails"
|
||||
stop
|
||||
reset default
|
||||
start 1.20.3-0
|
||||
stop
|
||||
download 1.20.2-0
|
||||
timeout 60 $DIR/forgejo-1.20.2-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
if ! grep --fixed-strings --quiet 'use the newer database' $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_bug_storage_merged() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "using < 1.20.3-0 and [storage].PATH merge all storage"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset merged
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
! test -d $work_path/data/$path
|
||||
done
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
! test -d $work_path/merged/$path
|
||||
done
|
||||
test -d $work_path/merged
|
||||
done
|
||||
stop
|
||||
|
||||
log_info "upgrading from 1.20.2-0 with [storage].PATH fails"
|
||||
download 1.20.3-0
|
||||
timeout 60 $DIR/forgejo-1.20.3-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
if ! grep --fixed-strings --quiet '[storage].PATH is set and may create storage issues' $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_bug_storage_relative_path() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "using < 1.20.3-0 legacy [server].XXXX and [picture].XXXX are relative to WORK_PATH"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset legagy-relative
|
||||
start $version
|
||||
test -d $work_path/relative-lfs
|
||||
test -d $work_path/relative-avatars
|
||||
test -d $work_path/relative-repo-avatars
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 legacy [server].XXXX and [picture].XXXX are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset legagy-relative
|
||||
start $version
|
||||
test -d $work_path/data/relative-lfs
|
||||
test -d $work_path/data/relative-avatars
|
||||
test -d $work_path/data/relative-repo-avatars
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 relative [storage.XXXX].PATHS are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
log_info "using 1.20.[12]-0 relative [storage.XXXX].PATHS are inconsistent"
|
||||
for version in 1.20.2-0 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
test -d $work_path/data/packages
|
||||
test -d $work_path/relative-repo-archive
|
||||
test -d $work_path/relative-attachments
|
||||
test -d $work_path/relative-lfs
|
||||
test -d $work_path/data/avatars
|
||||
test -d $work_path/data/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20 relative [storage.XXXX].PATHS are inconsistent"
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
stop
|
||||
reset storage-relative
|
||||
start $version
|
||||
test -d $work_path/relative-packages
|
||||
test -d $work_path/relative-repo-archive
|
||||
test -d $work_path/relative-attachments
|
||||
test -d $work_path/data/lfs
|
||||
test -d $work_path/data/avatars
|
||||
test -d $work_path/data/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20.3-0 relative [XXXX].PATHS are relative to WORK_PATH"
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 ; do
|
||||
stop
|
||||
reset relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
log_info "using >= 1.20.3-0 relative [XXXX].PATHS are relative to APP_DATA_PATH"
|
||||
for version in 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
stop
|
||||
reset relative
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/data/relative-$path
|
||||
done
|
||||
done
|
||||
|
||||
stop
|
||||
}
|
||||
|
||||
function test_bug_storage_s3_misplace() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
local s3_backend=${2:-minio}
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/issues/1338"
|
||||
|
||||
for version in 1.20.2-0 1.20.3-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
reset misplace-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
for fun in ${STORAGE_FUN} ; do
|
||||
fixture_${fun}_assert_s3
|
||||
done
|
||||
done
|
||||
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
log_info "Forgejo $version & $s3_backend"
|
||||
stop
|
||||
reset misplace-s3
|
||||
start $version $s3_backend
|
||||
fixture_create
|
||||
#
|
||||
# some storage are in S3
|
||||
#
|
||||
fixture_attachments_assert_s3
|
||||
fixture_lfs_assert_s3
|
||||
#
|
||||
# others are in local
|
||||
#
|
||||
fixture_repo_archive_assert_local elsewhere/repo-archive
|
||||
fixture_avatars_assert_local elsewhere/avatars
|
||||
fixture_packages_assert_local elsewhere/packages
|
||||
fixture_repo_avatars_assert_local elsewhere/repo-avatars
|
||||
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.5-0 1.19.4-0 1.20.2-0 1.20.3-0 ; do
|
||||
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
|
||||
reset stable-s3
|
||||
|
@ -488,59 +353,12 @@ function test_storage_stable_s3() {
|
|||
done
|
||||
}
|
||||
|
||||
function test_bug_storage_misplace() {
|
||||
local work_path=$DIR/forgejo-work-path
|
||||
|
||||
log_info "See also https://codeberg.org/forgejo/forgejo/pulls/1225"
|
||||
|
||||
log_info "using < 1.20 and conflicting sections misplace storage"
|
||||
for version in 1.18.5-0 1.19.4-0 ; do
|
||||
stop
|
||||
reset misplace
|
||||
start $version
|
||||
#
|
||||
# some storage are where they should be
|
||||
#
|
||||
test -d $work_path/data/packages
|
||||
test -d $work_path/data/repo-archive
|
||||
test -d $work_path/data/attachments
|
||||
#
|
||||
# others are under APP_DATA_PATH
|
||||
#
|
||||
test -d $work_path/elsewhere/lfs
|
||||
test -d $work_path/elsewhere/avatars
|
||||
test -d $work_path/elsewhere/repo-avatars
|
||||
done
|
||||
|
||||
log_info "using < 1.20.[12]-0 and conflicting sections ignores [storage.*]"
|
||||
for version in 1.20.2-0 ; do
|
||||
stop
|
||||
reset misplace
|
||||
start $version
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
test -d $work_path/elsewhere/$path
|
||||
done
|
||||
done
|
||||
|
||||
stop
|
||||
|
||||
log_info "upgrading from 1.20.2-0 with conflicting sections fails"
|
||||
download 1.20.3-0
|
||||
timeout 60 $DIR/forgejo-1.20.3-0 --config $work_path/app.ini --work-path $work_path || true
|
||||
for path in ${STORAGE_PATHS} ; do
|
||||
if ! grep --fixed-strings --quiet "[storage.$path] may conflict" $work_path/log/forgejo.log ; then
|
||||
cat $work_path/log/forgejo.log
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
function test_successful_upgrades() {
|
||||
for config in default specific ; do
|
||||
log_info "using $config app.ini"
|
||||
reset $config
|
||||
|
||||
for version in 1.18.5-0 1.19.4-0 1.20.2-0 1.20.3-0 1.21.0-5-rc2 ; do
|
||||
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
|
||||
|
@ -558,32 +376,6 @@ function test_forgejo_database_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
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
function run() {
|
||||
local fun=$1
|
||||
shift
|
||||
|
@ -603,17 +395,19 @@ function run() {
|
|||
echo Success running $fun
|
||||
}
|
||||
|
||||
source $SELF_DIR/test-upgrade-1.20-storage.sh
|
||||
source $SELF_DIR/test-upgrade-forgejo-database-v3.sh
|
||||
|
||||
function test_upgrades() {
|
||||
run stop
|
||||
run dependencies
|
||||
run build_all
|
||||
|
||||
run test_successful_upgrades
|
||||
run test_bug_storage_misplace
|
||||
run test_bug_storage_merged
|
||||
run test_downgrade_1.20.2_fails
|
||||
run test_bug_storage_s3_misplace
|
||||
run test_storage_stable_s3 minio
|
||||
run test_storage_stable_s3 garage
|
||||
|
||||
test_upgrade_1_20_storage
|
||||
run test_forgejo_database_v3_upgrades
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue