Skip to content

Commit d2e1734

Browse files
committed
[UPGRADE] add sanity check for v1.20.5-0
See https://forgejo.org/2023-10-release-v1-20-5-0/ (cherry picked from commit 7d619f79a0ebebf0de49be6175701769db04f7c2) (cherry picked from commit ce5c75e1532894c180c66c38f828fd647c3b8174) (cherry picked from commit 252c81f2bc16a3409c144fd5061c9c249af9be8d) (cherry picked from commit 552920251decd5a785076df22cb83b3317f8f437) (cherry picked from commit 15f1c851f0b83088e7c9ec815ee991a81ded94e9) (cherry picked from commit 9e542dcb302d5696b9fe2ea5889f641fd095c574) (cherry picked from commit 843f08fefd85ed62231db7aac8be4e1334ba3a41)
1 parent 65e37b9 commit d2e1734

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

.forgejo/upgrades/test-upgrade.sh

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ function log_info() {
4242
function dependencies() {
4343
maybe_sudo
4444
if ! which curl daemon jq git-lfs > /dev/null ; then
45-
$SUDO apt-get install -y -qq curl daemon git-lfs jq
45+
$SUDO apt-get install -y -qq curl daemon git-lfs jq sqlite3
4646
fi
4747

4848
if ! test -f /usr/local/bin/mc || ! test -f /usr/local/bin/minio > /dev/null ; then
4949
$SUDO curl --fail -sS https://dl.min.io/client/mc/release/linux-amd64/mc -o /usr/local/bin/mc
50-
$SUDO curl --fail -sS https://dl.min.io/server/minio/release/linux-amd64/archive/minio.RELEASE.2023-08-23T10-07-06Z -o /usr/local/bin/minio
50+
$SUDO curl --fail -sS https://dl.min.io/server/minio/release/linux-amd64/minio -o /usr/local/bin/minio
5151
fi
5252
if ! test -x /usr/local/bin/mc || ! test -x /usr/local/bin/minio > /dev/null ; then
5353
$SUDO chmod +x /usr/local/bin/mc
@@ -101,7 +101,11 @@ function download() {
101101

102102
if ! test -f $DIR/forgejo-$version ; then
103103
mkdir -p $DIR
104-
wget -O $DIR/forgejo-$version --quiet https://codeberg.org/forgejo/forgejo/releases/download/v$version/forgejo-$version-linux-amd64
104+
for owner in forgejo forgejo-experimental forgejo-integration ; do
105+
if wget -O $DIR/forgejo-$version --quiet https://codeberg.org/$owner/forgejo/releases/download/v$version/forgejo-$version-linux-amd64 ; then
106+
break
107+
fi
108+
done
105109
chmod +x $DIR/forgejo-$version
106110
fi
107111
}
@@ -555,6 +559,40 @@ function test_successful_upgrades() {
555559
done
556560
}
557561

562+
function test_forgejo_database_version() {
563+
local expected_version=$1
564+
local work_path=$DIR/forgejo-work-path
565+
566+
actual_version=$(sqlite3 $work_path/forgejo.db "select version from forgejo_version")
567+
test "$expected_version" = "$actual_version"
568+
}
569+
570+
function test_forgejo_database_v3_upgrades_list_table() {
571+
local table=$1
572+
local work_path=$DIR/forgejo-work-path
573+
574+
sqlite3 $work_path/forgejo.db ".tables $table" .exit | grep --quiet $table
575+
}
576+
577+
function test_forgejo_database_v3_upgrades() {
578+
local table=forgejo_auth_token
579+
580+
stop
581+
582+
reset default
583+
log_info "run 1.20.4-1"
584+
start 1.20.4-1
585+
stop
586+
! test_forgejo_database_v3_upgrades_list_table $table
587+
test_forgejo_database_version 2
588+
589+
log_info "run 1.20.5-0"
590+
start 1.20.5-0
591+
stop
592+
test_forgejo_database_v3_upgrades_list_table $table
593+
test_forgejo_database_version 3
594+
}
595+
558596
function run() {
559597
local fun=$1
560598
shift
@@ -585,6 +623,7 @@ function test_upgrades() {
585623
run test_bug_storage_s3_misplace
586624
run test_storage_stable_s3 minio
587625
run test_storage_stable_s3 garage
626+
run test_forgejo_database_v3_upgrades
588627
}
589628

590629
"$@"

0 commit comments

Comments
 (0)