feat(federation): add scenario-gotosocial setup and teardown (#1275)

3/5 taken out of #1269

This patch adds the setup and teardown of GoToSocial for use in the end-to-end tests

Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/1275
Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org>
Reviewed-by: Beowulf <beowulf@beocode.eu>
Co-authored-by: famfo <famfo@famfo.xyz>
Co-committed-by: famfo <famfo@famfo.xyz>
This commit is contained in:
famfo 2026-01-05 17:36:57 +00:00 committed by Beowulf
parent a57c631fae
commit 45417622c0
6 changed files with 98 additions and 0 deletions

View file

@ -79,6 +79,7 @@ function test_federation() {
scenarios=(
"star 7.1"
"mastodon 14.0"
"gotosocial 14.0"
)
for scenario_version_str in "${scenarios[@]}"; do

View file

View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
source "$DIR/federation_scenario-$scenario-env"
if [[ -z "$password" ]]; then
exit 1
fi
if [[ -z "$port" ]]; then
exit 1
fi
status_code="$(curl -o /dev/null -w '%{http_code}' "http://localhost:$port/")"
if [[ "$status_code" != "200" ]]; then
exit 1
fi

View file

@ -0,0 +1,58 @@
#!/usr/bin/env bash
source $SCENARIO_DIR/../../lib/lib.sh
GTS_VERSION="0.20.2" # renovate: datasource=docker depName=data.forgejo.org/oci/gotosocial
echo "setting up gotosocial"
tmpdir="$(mktemp --tmpdir -d gts.XXXXXXXXXX)"
cat << EOF > "$tmpdir/config.yaml"
host: "localhost:8080"
protocol: http
db-type: sqlite
db-address: /mount/gts.db3
http-client:
allow-ips: ["0.0.0.0/0", "::/0"]
insecure-outgoing: true
EOF
podman unshare \
chown 1000:1000 -R $tmpdir
container_id="$(
podman run \
-d \
--env "GTS_CONFIG_PATH=/mount/config.yaml" \
-v "$tmpdir:/mount" \
-p "8080:8080" \
--network=host \
"data.forgejo.org/oci/gotosocial:$GTS_VERSION" \
server start
)"
function wait_gts_ready() {
http_status=$(curl -s -w \
"%{http_code}" -o /dev/null \
"http://localhost:8080/"
)
[[ "$http_status" == 200 ]] && echo "ready"
}
retry wait_gts_ready
password="verysecurepassword"
podman exec -it "$container_id" /gotosocial/gotosocial admin \
account create \
--username "test" \
--email "test@localhost" \
--password "$password"
cat << EOF > "$DIR/federation_scenario-gotosocial-env"
password="$password"
port="8080"
container_id="$container_id"
EOF

View file

@ -0,0 +1,12 @@
#!/usr/bin/env bash
source "$DIR/federation_scenario-gotosocial-env"
if [[ -z "$container_id" ]]; then
echo "gotosocial container ID not found, container may not be stopped"
exit 1
fi
podman stop "$container_id"
rm "$DIR/federation_scenario-gotosocial-env"

11
run.sh Executable file
View file

@ -0,0 +1,11 @@
#!/usr/bin/env bash
podman build -t forgejo-e2e .
patchelf ../forgejo/forgejo --set-interpreter /lib64/ld-linux-x86-64.so.2
podman run \
-it --privileged \
-v ../forgejo/gitea:/srv/forgejo-binaries/forgejo-14.0 \
-p 3001-3003:3001-3003 \
-p 4000:4000 \
-p 8080:8080 \
forgejo-e2e