feat(federation): add scenario-mastodon setup and teardown (#1274)
2/5 taken out of #1269 This patch adds the setup and teardown of Mastodon for use in the end-to-end tests Co-Authored-By: zam <mirco.zachmann@meissa.de> Co-Authored-By: erik <erik.seiert@meissa-gmbh.de> Co-Authored-By: Michael Jerger <michael.jerger@meissa-gmbh.de> Reviewed-on: https://code.forgejo.org/forgejo/end-to-end/pulls/1274 Reviewed-by: earl-warren <earl-warren@noreply.code.forgejo.org> Reviewed-by: Beowulf <beowulf@noreply.code.forgejo.org> Co-authored-by: famfo <famfo@famfo.xyz> Co-committed-by: famfo <famfo@famfo.xyz>
This commit is contained in:
parent
1064337c89
commit
a57c631fae
19 changed files with 395 additions and 0 deletions
48
federation/scenario-mastodon/setup.sh
Executable file
48
federation/scenario-mastodon/setup.sh
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
source "$SCENARIO_DIR/../../lib/lib.sh"
|
||||
source "$SCENARIO_DIR/functions.sh"
|
||||
|
||||
echo "Setting up Forgejo x Mastodon"
|
||||
|
||||
if [[ ! -d "$DIR" ]]; then
|
||||
mkdir -p "$DIR"
|
||||
fi
|
||||
|
||||
echo "Generating forgejo & mastodon self-signed certificate"
|
||||
|
||||
generate_certs forgejo "$SCENARIO_DIR/resources/certs"
|
||||
|
||||
mv "$SCENARIO_DIR/resources/certs/forgejo"* "$SCENARIO_DIR/forgejo/certs/"
|
||||
|
||||
export MASTODON_HOST="localhost"
|
||||
|
||||
podman-compose \
|
||||
-f "$SCENARIO_DIR/compose.yaml" \
|
||||
up -d
|
||||
|
||||
function wait_up() {
|
||||
command="$(podman-compose \
|
||||
-f "$SCENARIO_DIR/compose.yaml" \
|
||||
exec mastodon-app \
|
||||
bin/tootctl accounts
|
||||
)"
|
||||
|
||||
first="$(head -n 1 <<< "$command")"
|
||||
[[ "$first" == *"Commands:"* ]] && echo "ready"
|
||||
}
|
||||
|
||||
retry wait_up
|
||||
|
||||
password="$(podman-compose \
|
||||
-f "$SCENARIO_DIR/compose.yaml" \
|
||||
exec mastodon-app \
|
||||
bash -c "/init/create_test_account.sh" | \
|
||||
tail -n 1 | \
|
||||
sed 's/\r//'
|
||||
)"
|
||||
|
||||
cat << EOF > "$DIR/federation_scenario-mastodon-env"
|
||||
password="$password"
|
||||
port="4000"
|
||||
EOF
|
||||
Loading…
Add table
Add a link
Reference in a new issue