end-to-end/upgrade/upgrade.sh
Earl Warren 427c46dbf9
lib: remove RELEASE_NUMBERS_AND_DEV, use RELEASE_NUMBERS
In the lifecycle of vX.Y.Z, all tests are run against vX.Y-test
before it is published, including when the tag is pushed because the
automated release process now runs end-to-end before pushing the
release to forgejo-experimental.

Running end-to-end against vX.Y-dev is therefore redundant with at least
two other runs with exactly the same SHA (the one before the tag is
pushed and the one when the tag is pushed). There would be value in
doing that if it allowed to detect race conditions in Forgejo. But
such races were not found in the past six months and there is a lot
more scrutiny on commits merged in Forgejo which makes it even less
likely than it was before.

Running the tests on vX.Y instead of also including the built version
provide the same coverage and reduces the workload.
2024-08-08 17:46:04 +02:00

89 lines
2 KiB
Bash
Executable file

# SPDX-License-Identifier: MIT
UPGRADE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
function upgrade_reset() {
local config=$1
reset_forgejo $config
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() {
stop
for config in $UPGRADE_DIR/default-app.ini; do
log_info "using $config"
upgrade_reset $config
version=7.0
log_info "run $version"
cleanup_storage
start $version
fixture_create
fixture_assert
doctor_run $config
for version in $RELEASE_NUMBERS; do
stop
log_info "run $version"
start $version
verify_storage
fixture_assert
doctor_run $config
done
done
}
function test_gitea_upgrades() {
local config=$UPGRADE_DIR/default-app.ini
(
echo gitea 1.21 forgejo 7.0-dev
echo gitea 1.21 forgejo 9.0-dev
echo gitea 1.22 forgejo 9.0-dev
) | while read gitea gitea_version forgejo forgejo_version; do
log_info "upgrading from Gitea $gitea_version to Forgejo $forgejo_version"
stop
upgrade_reset $config
log_info "run Gitea $gitea_version"
cleanup_storage
start_s3 minio
start_gitea $gitea_version $config
fixture_create
fixture_assert
doctor_run $config
stop
log_info "run Forgejo $forgejo_version"
start $forgejo_version
verify_storage
fixture_assert
doctor_run $config
done
}
source $UPGRADE_DIR/test-pprof-upload.sh
function test_upgrades() {
run dependencies
run build_all
run test_successful_upgrades
run test_forgejo_pprof
run test_gitea_upgrades
}