Allow running docker-less federation tests locally
This commit is contained in:
parent
d5955b60c0
commit
e492cce206
3 changed files with 47 additions and 10 deletions
|
@ -65,7 +65,8 @@ steps:
|
||||||
- name: run federation tests
|
- name: run federation tests
|
||||||
image: node:15-alpine3.12
|
image: node:15-alpine3.12
|
||||||
environment:
|
environment:
|
||||||
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432/lemmy
|
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
|
||||||
|
DO_WRITE_HOSTS_FILE: 1
|
||||||
commands:
|
commands:
|
||||||
- ls -la target/lemmy_server
|
- ls -la target/lemmy_server
|
||||||
- apk add bash curl postgresql-client
|
- apk add bash curl postgresql-client
|
||||||
|
|
|
@ -12,17 +12,33 @@ export LEMMY_TEST_SEND_SYNC=1
|
||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
|
|
||||||
for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
|
for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
|
||||||
psql "$LEMMY_DATABASE_URL" -c "CREATE DATABASE $INSTANCE"
|
psql "${LEMMY_DATABASE_URL}/lemmy" -c "DROP DATABASE IF EXISTS $INSTANCE"
|
||||||
|
psql "${LEMMY_DATABASE_URL}/lemmy" -c "CREATE DATABASE $INSTANCE"
|
||||||
done
|
done
|
||||||
|
|
||||||
for INSTANCE in lemmy-alpha lemmy-beta lemmy-gamma lemmy-delta lemmy-epsilon; do
|
if [ -z "$DO_WRITE_HOSTS_FILE" ]; then
|
||||||
echo "127.0.0.1 $INSTANCE" >> /etc/hosts
|
if ! grep -q lemmy-alpha /etc/hosts; then
|
||||||
done
|
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
|
||||||
|
|
||||||
|
killall lemmy_server || true
|
||||||
|
|
||||||
echo "start alpha"
|
echo "start alpha"
|
||||||
LEMMY_HOSTNAME=lemmy-alpha:8541 \
|
LEMMY_HOSTNAME=lemmy-alpha:8541 \
|
||||||
LEMMY_PORT=8541 \
|
LEMMY_PORT=8541 \
|
||||||
LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_alpha \
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_alpha" \
|
||||||
LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon \
|
LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta,lemmy-gamma,lemmy-delta,lemmy-epsilon \
|
||||||
LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha \
|
LEMMY_SETUP__ADMIN_USERNAME=lemmy_alpha \
|
||||||
LEMMY_SETUP__SITE_NAME=lemmy-alpha \
|
LEMMY_SETUP__SITE_NAME=lemmy-alpha \
|
||||||
|
@ -31,7 +47,7 @@ LEMMY_HOSTNAME=lemmy-alpha:8541 \
|
||||||
echo "start beta"
|
echo "start beta"
|
||||||
LEMMY_HOSTNAME=lemmy-beta:8551 \
|
LEMMY_HOSTNAME=lemmy-beta:8551 \
|
||||||
LEMMY_PORT=8551 \
|
LEMMY_PORT=8551 \
|
||||||
LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_beta \
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_beta" \
|
||||||
LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma,lemmy-delta,lemmy-epsilon \
|
LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-gamma,lemmy-delta,lemmy-epsilon \
|
||||||
LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta \
|
LEMMY_SETUP__ADMIN_USERNAME=lemmy_beta \
|
||||||
LEMMY_SETUP__SITE_NAME=lemmy-beta \
|
LEMMY_SETUP__SITE_NAME=lemmy-beta \
|
||||||
|
@ -40,7 +56,7 @@ LEMMY_HOSTNAME=lemmy-beta:8551 \
|
||||||
echo "start gamma"
|
echo "start gamma"
|
||||||
LEMMY_HOSTNAME=lemmy-gamma:8561 \
|
LEMMY_HOSTNAME=lemmy-gamma:8561 \
|
||||||
LEMMY_PORT=8561 \
|
LEMMY_PORT=8561 \
|
||||||
LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_gamma \
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_gamma" \
|
||||||
LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta,lemmy-delta,lemmy-epsilon \
|
LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-alpha,lemmy-beta,lemmy-delta,lemmy-epsilon \
|
||||||
LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma \
|
LEMMY_SETUP__ADMIN_USERNAME=lemmy_gamma \
|
||||||
LEMMY_SETUP__SITE_NAME=lemmy-gamma \
|
LEMMY_SETUP__SITE_NAME=lemmy-gamma \
|
||||||
|
@ -50,7 +66,7 @@ echo "start delta"
|
||||||
# An instance with only an allowlist for beta
|
# An instance with only an allowlist for beta
|
||||||
LEMMY_HOSTNAME=lemmy-delta:8571 \
|
LEMMY_HOSTNAME=lemmy-delta:8571 \
|
||||||
LEMMY_PORT=8571 \
|
LEMMY_PORT=8571 \
|
||||||
LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_delta \
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_delta" \
|
||||||
LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta \
|
LEMMY_FEDERATION__ALLOWED_INSTANCES=lemmy-beta \
|
||||||
LEMMY_SETUP__ADMIN_USERNAME=lemmy_delta \
|
LEMMY_SETUP__ADMIN_USERNAME=lemmy_delta \
|
||||||
LEMMY_SETUP__SITE_NAME=lemmy-delta \
|
LEMMY_SETUP__SITE_NAME=lemmy-delta \
|
||||||
|
@ -60,7 +76,7 @@ echo "start epsilon"
|
||||||
# An instance who has a blocklist, with lemmy-alpha blocked
|
# An instance who has a blocklist, with lemmy-alpha blocked
|
||||||
LEMMY_HOSTNAME=lemmy-epsilon:8581 \
|
LEMMY_HOSTNAME=lemmy-epsilon:8581 \
|
||||||
LEMMY_PORT=8581 \
|
LEMMY_PORT=8581 \
|
||||||
LEMMY_DATABASE_URL=postgres://lemmy:password@database:5432/lemmy_epsilon \
|
LEMMY_DATABASE_URL="${LEMMY_DATABASE_URL}/lemmy_epsilon" \
|
||||||
LEMMY_FEDERATION__BLOCKED_INSTANCES=lemmy-alpha \
|
LEMMY_FEDERATION__BLOCKED_INSTANCES=lemmy-alpha \
|
||||||
LEMMY_SETUP__ADMIN_USERNAME=lemmy_epsilon \
|
LEMMY_SETUP__ADMIN_USERNAME=lemmy_epsilon \
|
||||||
LEMMY_SETUP__SITE_NAME=lemmy-epsilon \
|
LEMMY_SETUP__SITE_NAME=lemmy-epsilon \
|
||||||
|
|
20
api_tests/run-federation-test.sh
Executable file
20
api_tests/run-federation-test.sh
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
export LEMMY_DATABASE_URL=postgres://lemmy:password@localhost:5432
|
||||||
|
|
||||||
|
pushd ..
|
||||||
|
cargo +1.47.0 build
|
||||||
|
rm target/lemmy_server || true
|
||||||
|
cp target/debug/lemmy_server target/lemmy_server
|
||||||
|
./api_tests/prepare-drone-federation-test.sh
|
||||||
|
popd
|
||||||
|
|
||||||
|
yarn
|
||||||
|
yarn api-test || true
|
||||||
|
|
||||||
|
killall lemmy_server
|
||||||
|
|
||||||
|
for INSTANCE in lemmy_alpha lemmy_beta lemmy_gamma lemmy_delta lemmy_epsilon; do
|
||||||
|
psql "$LEMMY_DATABASE_URL" -c "DROP DATABASE $INSTANCE"
|
||||||
|
done
|
Loading…
Reference in a new issue