Skip to content

Commit

Permalink
fix test-sim-rolling-upgrade.sh
Browse files Browse the repository at this point in the history
This test involves a satellite with dev defaults (DistinctIP=no) being
upgraded past commit 2522ff0, which
means we need to run the dev-defaults-satellite-upgrade migration SQL
to avoid getting DistinctIP=yes behavior:

    UPDATE nodes SET last_net = last_ip_port

Change-Id: I29fb596d1ffa568dad635d98cfe9abacd3aaa48f
  • Loading branch information
thepaul committed Mar 9, 2023
1 parent 0c177ef commit 0bfa266
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions scripts/tests/rollingupgrade/test-sim-rolling-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,20 @@ echo -e "\nSetting up stage 2 in ${test_dir}"
setup_stage "${test_dir}" "${stage2_sat_version}" "${stage2_storagenode_versions}" "2"
echo -e "\nRunning stage 2."

# For cases where the old satellite predates changeset I0e7e92498c3da768df5b4d5fb213dcd2d4862924,
# adjust all last_net values for future compatibility. this migration step is only necessary for
# satellites which existed before the aforementioned changeset and use dev defaults (to be specific,
# DistinctIP is off). This is a harmless change for any other satellites using dev defaults.
if [ "${STORJ_SIM_POSTGRES#cockroach:}" != "$STORJ_SIM_POSTGRES" ]; then
schema_set=
pgurl="${STORJ_SIM_POSTGRES/cockroach:/postgres:}"
pgurl="${pgurl%?sslmode=disable}/satellite/0?sslmode=disable"
else
schema_set='set search_path to "satellite/0"; '
pgurl="$STORJ_SIM_POSTGRES"
fi
psql "$pgurl" -c "${schema_set}update nodes set last_net = last_ip_port"

# Starting old satellite api in the background
has_marketing_server=$(echo $stage1_sat_version | awk 'BEGIN{FS="[v.]"} ($2 == 1 && $3 <= 22) || $2 == 0 {print $0}')
if [ "$has_marketing_server" != "" ]; then
Expand Down

0 comments on commit 0bfa266

Please sign in to comment.