scripts/tests/: fix uplink access to contain satellite id

Change-Id: I7dfb6bc2da3bf84a81d75a286ee9488e32ea4f01
This commit is contained in:
Yingrong Zhao 2020-03-10 14:58:14 -04:00 committed by Stefan Benten
parent de59e8e124
commit 46b04a38cc
4 changed files with 14 additions and 24 deletions

View File

@ -11,6 +11,7 @@ set -ueo pipefail
# uploaded via scripts/test-versions.sh
main_cfg_dir=$1
existing_bucket_name_suffixes=$2
update_access_script_path=$3
bucket="bucket-123"
test_files_dir="${main_cfg_dir}/testfiles"
@ -26,8 +27,9 @@ shasum $(which storj-sim)
if [ ! -d ${main_cfg_dir}/uplink-old-api ]; then
mkdir -p ${main_cfg_dir}/uplink-old-api
access=$(storj-sim --config-dir=$main_cfg_dir network env GATEWAY_0_ACCESS)
new_access=$(go run $update_access_script_path $(storj-sim --config-dir=$main_cfg_dir network env SATELLITE_0_DIR) $access)
old_sat_api_addr="127.0.0.1:30000"
uplink import --satellite-addr="$old_sat_api_addr" --config-dir="${main_cfg_dir}/uplink-old-api" "$access" --client.segment-size="64.0 KiB"
uplink import --satellite-addr="$old_sat_api_addr" --config-dir="${main_cfg_dir}/uplink-old-api" "$new_access" --client.segment-size="64.0 KiB"
fi
echo -e "\nConfig directory for uplink:"

View File

@ -238,26 +238,19 @@ cp -r $(version_dir ${stage1_sat_version}) ${test_dir}
echo -e "\nSetting up stage 1 in ${test_dir}"
test_versions_path="$( dirname "${scriptdir}" )/testversions/test-versions.sh"
setup_stage "${test_dir}" "${stage1_sat_version}" "${stage1_storagenode_versions}" "1"
update_access_script_path="$(version_dir $current_commit)/scripts/update-access.go"
# Uploading files to the network using the latest release version
echo "Stage 1 uplink version: ${stage1_uplink_version}"
src_ul_version_dir=$(version_dir ${stage1_uplink_version})
ln -f ${src_ul_version_dir}/bin/uplink $test_dir/bin/uplink
# use test-versions.sh instead of test-rolling-upgrade.sh for upload step, since the setup for the two tests should be identical
PATH=$test_dir/bin:$PATH storj-sim -x --host "${STORJ_NETWORK_HOST4}" --config-dir "${test_dir}/local-network" network test bash "${test_versions_path}" "${test_dir}/local-network" "upload" "${stage1_uplink_version}"
PATH=$test_dir/bin:$PATH storj-sim -x --host "${STORJ_NETWORK_HOST4}" --config-dir "${test_dir}/local-network" network test bash "${test_versions_path}" "${test_dir}/local-network" "upload" "${stage1_uplink_version}" "$update_access_script_path"
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."
# update gateway access to contain satellite id in satellite address
if [[ -f "$test_dir"/scripts/update-access.go ]]
then
PATH=$test_dir/bin:$PATH old_access=$(storj-sim network env --config-dir=${test_dir}/local-network/ GATEWAY_0_ACCESS)
PATH=$test_dir/bin:$PATH new_access=$(go run "$test_dir"/scripts/update-access.go $(storj-sim network env --config-dir=${test_dir}/local-network/ SATELLITE_0_DIR) $(storj-sim network env --config-dir=${test_dir}/local-network/ GATEWAY_0_ACCESS))
replace_in_file "$old_access" "$new_access" "${test_dir}/local-network/gateway/config.yaml"
fi
# Starting old satellite api in the background
old_api_cmd="${test_dir}/local-network/satellite/0/old_satellite run api --config-dir ${test_dir}/local-network/satellite/0/ --debug.addr 127.0.0.1:30009 --server.address 127.0.0.1:30000 --server.private-address 127.0.0.1:30001 --console.address 127.0.0.1:30002 --marketing.address 127.0.0.1:30003"
nohup $old_api_cmd &
@ -269,7 +262,7 @@ for ul_version in ${stage2_uplink_versions}; do
echo "Stage 2 uplink version: ${ul_version}"
src_ul_version_dir=$(version_dir ${ul_version})
ln -f ${src_ul_version_dir}/bin/uplink $test_dir/bin/uplink
PATH=$test_dir/bin:$PATH storj-sim -x --host "${STORJ_NETWORK_HOST4}" --config-dir "${test_dir}/local-network" network test bash "${scriptdir}/test-rolling-upgrade.sh" "${test_dir}/local-network" "${stage1_uplink_version}"
PATH=$test_dir/bin:$PATH storj-sim -x --host "${STORJ_NETWORK_HOST4}" --config-dir "${test_dir}/local-network" network test bash "${scriptdir}/test-rolling-upgrade.sh" "${test_dir}/local-network" "${stage1_uplink_version}" "$update_access_script_path"
if [[ $ul_version == $current_commit ]]
then

View File

@ -208,13 +208,14 @@ test_dir=$(version_dir "test_dir")
cp -r $(version_dir ${stage1_sat_version}) ${test_dir}
echo -e "\nSetting up stage 1 in ${test_dir}"
setup_stage "${test_dir}" "${stage1_sat_version}" "${stage1_storagenode_versions}"
update_access_script_path="$(version_dir "master")/scripts/update-access.go"
# Uploading files to the network using the latest release version for each uplink version
for ul_version in ${stage1_uplink_versions}; do
echo "Stage 1 Uplink version: ${ul_version}"
src_ul_version_dir=$(version_dir ${ul_version})
ln -f ${src_ul_version_dir}/bin/uplink $test_dir/bin/uplink
PATH=$test_dir/bin:$PATH storj-sim -x --host "${STORJ_NETWORK_HOST4}" --config-dir "${test_dir}/local-network" network test bash "${scriptdir}/test-versions.sh" "${test_dir}/local-network" "upload" "${ul_version}"
PATH=$test_dir/bin:$PATH storj-sim -x --host "${STORJ_NETWORK_HOST4}" --config-dir "${test_dir}/local-network" network test bash "${scriptdir}/test-versions.sh" "${test_dir}/local-network" "upload" "${ul_version}" "$update_access_script_path"
done
# Remove current uplink config to regenerate uplink config for older uplink version
rm -rf "${test_dir}/local-network/uplink"
@ -223,20 +224,12 @@ echo -e "\nSetting up stage 2 in ${test_dir}"
setup_stage "${test_dir}" "${stage2_sat_version}" "${stage2_storagenode_versions}"
echo -e "\nRunning stage 2."
# update gateway access to contain satellite id in satellite address
if [[ -f "$test_dir"/scripts/update-access.go ]]
then
PATH=$test_dir/bin:$PATH old_access=$(storj-sim network env --config-dir=${test_dir}/local-network/ GATEWAY_0_ACCESS)
PATH=$test_dir/bin:$PATH new_access=$(go run "$test_dir"/scripts/update-access.go $(storj-sim network env --config-dir=${test_dir}/local-network/ SATELLITE_0_DIR) $(storj-sim network env --config-dir=${test_dir}/local-network/ GATEWAY_0_ACCESS))
replace_in_file "$old_access" "$new_access" "${test_dir}/local-network/gateway/config.yaml"
fi
# Downloading every file uploaded in stage 1 from the network using the latest commit from master branch for each uplink version
for ul_version in ${stage2_uplink_versions}; do
echo "Stage 2 Uplink version: ${ul_version}"
src_ul_version_dir=$(version_dir ${ul_version})
ln -f ${src_ul_version_dir}/bin/uplink $test_dir/bin/uplink
PATH=$test_dir/bin:$PATH storj-sim -x --host "${STORJ_NETWORK_HOST4}" --config-dir "${test_dir}/local-network" network test bash "${scriptdir}/test-versions.sh" "${test_dir}/local-network" "download" "${ul_version}" "${stage1_uplink_versions}"
PATH=$test_dir/bin:$PATH storj-sim -x --host "${STORJ_NETWORK_HOST4}" --config-dir "${test_dir}/local-network" network test bash "${scriptdir}/test-versions.sh" "${test_dir}/local-network" "download" "${ul_version}" "${stage1_uplink_versions}" "$update_access_script_path"
done

View File

@ -5,6 +5,7 @@ set -ueo pipefail
main_cfg_dir=$1
command=$2
uplink_version=$3
update_access_script_path=$4
bucket="bucket-123"
test_files_dir="${main_cfg_dir}/testfiles"
@ -57,7 +58,8 @@ if [ ! -d ${main_cfg_dir}/uplink ]; then
should_use_access=$(echo $uplink_version | awk 'BEGIN{FS="[v.]"} $3 >= 30 || $2 >= 1 {print $0}')
if [[ ${#should_use_access} -gt 0 ]]; then
access=$(storj-sim --config-dir=$main_cfg_dir network env GATEWAY_0_ACCESS)
uplink import --config-dir="${main_cfg_dir}/uplink" "${access}" --client.segment-size="64.0 KiB"
new_access=$(go run $update_access_script_path $(storj-sim --config-dir=$main_cfg_dir network env SATELLITE_0_DIR) $access)
uplink import --config-dir="${main_cfg_dir}/uplink" "${new_access}" --client.segment-size="64.0 KiB"
else
uplink setup --config-dir="${main_cfg_dir}/uplink" --non-interactive --api-key="$api_key" --satellite-addr="$sat_addr" --enc.encryption-key="test" --client.segment-size="64.0 KiB"
fi
@ -76,8 +78,8 @@ then
# super hack:
access=$(head -n 1 ${main_cfg_dir}/uplink/access.txt)
echo "import for uplink $access"
uplink import --config-dir="${main_cfg_dir}/uplink" "${access}"
new_access=$(go run $update_access_script_path $(storj-sim --config-dir=$main_cfg_dir network env SATELLITE_0_DIR) $access)
uplink import --config-dir="${main_cfg_dir}/uplink" "${new_access}"
rm -rf ${main_cfg_dir}/uplink/access.txt
fi