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.
86 lines
2.2 KiB
Bash
Executable file
86 lines
2.2 KiB
Bash
Executable file
# Copyright 2024 The Forgejo Authors
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
FEDERATION_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
export FEDERATION_INSTANCES="ONE TWO"
|
|
export FEDERATION_CONFIGS
|
|
|
|
function federation_setup_variables() {
|
|
if test "$FEDERATION_CONFIGS"; then
|
|
return
|
|
fi
|
|
for instance in $FEDERATION_INSTANCES; do
|
|
local config=$FEDERATION_DIR/$instance-app.ini
|
|
FEDERATION_CONFIGS="$FEDERATION_CONFIGS $config"
|
|
local base=$(work_path_base $config)
|
|
local work_path=$DIR/$base
|
|
local host_port=$(get_host_port $config)
|
|
|
|
eval export ${instance}_CONFIG=$config
|
|
eval export ${instance}_CURL=$work_path/forgejo-curl.sh
|
|
eval export ${instance}_HOST_PORT=$host_port
|
|
done
|
|
}
|
|
|
|
function federation_verify_scenario() {
|
|
local scenario=$1
|
|
|
|
export scenario
|
|
export SCENARIO_DIR=$FEDERATION_DIR/scenario-$scenario
|
|
|
|
if test -f $SCENARIO_DIR/setup.sh; then
|
|
echo "============================ SETUP scenario-$scenario ==================="
|
|
bash -ex $SCENARIO_DIR/setup.sh || return 1
|
|
fi
|
|
|
|
echo "============================ RUN scenario-$scenario ==================="
|
|
bash -ex $SCENARIO_DIR/run.sh || return 1
|
|
|
|
if test -f $SCENARIO_DIR/teardown.sh; then
|
|
echo "============================ TEARDOWN scenario-$scenario ==================="
|
|
bash -ex $SCENARIO_DIR/teardown.sh || return 1
|
|
fi
|
|
}
|
|
|
|
function federation_setup() {
|
|
federation_setup_variables
|
|
|
|
local version=$1
|
|
federation_teardown
|
|
|
|
local config
|
|
for config in $FEDERATION_CONFIGS; do
|
|
reset_forgejo $config
|
|
start_forgejo $version $config
|
|
done
|
|
}
|
|
|
|
function federation_teardown() {
|
|
federation_setup_variables
|
|
|
|
local config
|
|
for config in $FEDERATION_CONFIGS; do
|
|
stop_forgejo $config
|
|
done
|
|
}
|
|
|
|
function test_federation() {
|
|
# start_gitlab octobus/heptapod:1.5.3
|
|
federation_setup_variables
|
|
|
|
local versions="${1:-$RELEASE_NUMBERS}"
|
|
|
|
for version in $versions; do
|
|
|
|
if dpkg --compare-versions $version lt 7.1; then
|
|
continue
|
|
fi
|
|
|
|
federation_setup $version
|
|
|
|
for scenario in star; do
|
|
run federation_verify_scenario $scenario
|
|
done
|
|
done
|
|
}
|