lemmy/api_tests/prepare-drone-federation-te...

76 lines
3.1 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
# IMPORTANT NOTE: this script does not use the normal LEMMY_DATABASE_URL format
# it is expected that this script is called by run-federation-test.sh script.
2020-12-10 10:03:11 -07:00
set -e
export RUST_BACKTRACE=1
2021-10-16 07:33:38 -06:00
export RUST_LOG="warn,lemmy_server=debug,lemmy_api=debug,lemmy_api_common=debug,lemmy_api_crud=debug,lemmy_apub=debug,lemmy_db_schema=debug,lemmy_db_views=debug,lemmy_db_views_actor=debug,lemmy_db_views_moderator=debug,lemmy_routes=debug,lemmy_utils=debug,lemmy_websocket=debug"
2020-12-10 10:03:11 -07:00
2020-12-11 10:09:47 -07:00
for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
echo "DB URL: ${LEMMY_DATABASE_URL} INSTANCE: $INSTANCE"
psql "${LEMMY_DATABASE_URL}/lemmy" -c "DROP DATABASE IF EXISTS $INSTANCE"
echo "create database"
psql "${LEMMY_DATABASE_URL}/lemmy" -c "CREATE DATABASE $INSTANCE"
2020-12-11 10:09:47 -07:00
done
if [ -z "$DO_WRITE_HOSTS_FILE" ]; then
if ! grep -q lemmy-alpha /etc/hosts; then
echo "Please add the following to your /etc/hosts file, then press enter:
127.0.0.1 lemmy-alpha
127.0.0.1 lemmy-beta
127.0.0.1 lemmy-gamma
127.0.0.1 lemmy-delta
127.0.0.1 lemmy-epsilon"
read -p ""
fi
else
for INSTANCE in lemmy-alpha lemmy-beta lemmy-gamma lemmy-delta lemmy-epsilon; do
echo "127.0.0.1 $INSTANCE" >> /etc/hosts
done
fi
echo "killall existing lemmy_server processes"
Enhanced testing of comments. Validate reply notifications, mentions (#3686) * shared.ts first test of getReplies * comment testing now validates reply notifications and mentions, some code comment cleanup in other functions * comments revised * first use of getUnreadCount in testing * test notification of new comment replies, clarify usage of getReplies * killall moved earlier in bash script * api-test jest run does not need directory prefix, make consistent with other jest runs * do not put my testing system password into script * fix, killall exits script when no process found * killall now moved to parent script to release locks before database create * need to run killall a second time, before database drop * first use of getReplies getPosts saveUserSettings * accidental duplication of functions, removed * try to sync shared library with main * Nutomic feedback: Better to rename the var instead of putting a comment which can easily get outdated. * Correct logic to meet join-lemmy requirement, don't have closed signups. Allows Open and Applications. (#3761) Co-authored-by: Josh Bernardini <josh.bernardini@cologix.com> * Fix fetch instance software version from nodeinfo (#3772) Fixes #3771 * remove unused code, revert killall change --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com> Co-authored-by: figure-0e <133478007+figure-0e@users.noreply.github.com> Co-authored-by: Josh Bernardini <josh.bernardini@cologix.com> Co-authored-by: Denis Dzyubenko <denis@ddenis.info> Co-authored-by: Felix Ableitner <me@nutomic.com>
2023-08-01 07:14:40 -06:00
killall -s1 lemmy_server || true
2020-12-11 10:22:16 -07:00
echo "$PWD"
2020-12-10 10:03:11 -07:00
echo "start alpha"
2022-11-09 03:05:00 -07:00
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_alpha.hjson \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_alpha" \
target/lemmy_server >/tmp/lemmy_alpha.out 2>&1 &
2020-12-10 10:03:11 -07:00
echo "start beta"
2022-11-09 03:05:00 -07:00
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_beta.hjson \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_beta" \
target/lemmy_server >/tmp/lemmy_beta.out 2>&1 &
2020-12-10 10:03:11 -07:00
echo "start gamma"
2022-11-09 03:05:00 -07:00
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_gamma.hjson \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_gamma" \
target/lemmy_server >/tmp/lemmy_gamma.out 2>&1 &
2020-12-10 10:03:11 -07:00
echo "start delta"
# An instance with only an allowlist for beta
2022-11-09 03:05:00 -07:00
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_delta.hjson \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_delta" \
target/lemmy_server >/tmp/lemmy_delta.out 2>&1 &
2020-12-10 10:03:11 -07:00
echo "start epsilon"
# An instance who has a blocklist, with lemmy-alpha blocked
2022-11-09 03:05:00 -07:00
LEMMY_CONFIG_LOCATION=./docker/federation/lemmy_epsilon.hjson \
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_epsilon" \
target/lemmy_server >/tmp/lemmy_epsilon.out 2>&1 &
2020-12-10 10:03:11 -07:00
echo "wait for all instances to start"
2022-11-09 03:05:00 -07:00
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-alpha:8541/api/v3/site')" != "200" ]]; do sleep 1; done
echo "alpha started"
2022-11-09 03:05:00 -07:00
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-beta:8551/api/v3/site')" != "200" ]]; do sleep 1; done
echo "beta started"
2022-11-09 03:05:00 -07:00
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-gamma:8561/api/v3/site')" != "200" ]]; do sleep 1; done
echo "gamma started"
2022-11-09 03:05:00 -07:00
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-delta:8571/api/v3/site')" != "200" ]]; do sleep 1; done
echo "delta started"
2022-11-09 03:05:00 -07:00
while [[ "$(curl -s -o /dev/null -w '%{http_code}' 'lemmy-epsilon:8581/api/v3/site')" != "200" ]]; do sleep 1; done
echo "epsilon started. All started"