test-federation-live

This commit is contained in:
Mayel de Borniol 2023-09-17 15:39:53 +01:00
parent a60c99f3c6
commit 8dfed50aae
3 changed files with 14 additions and 8 deletions

View file

@ -12,8 +12,6 @@ config :activity_pub, :endpoint_module, Bonfire.Web.Endpoint
config :activity_pub, Oban, repo: Bonfire.Common.Repo
config :tesla, adapter: Tesla.Mock
# Print only warnings and errors during test
config :logger, level: :warn

View file

@ -60,11 +60,12 @@ config :bonfire, Bonfire.Web.FakeRemoteEndpoint,
render_errors: [view: Bonfire.UI.Common.ErrorView, accepts: ~w(html json), layout: false]
test_instance? = System.get_env("TEST_INSTANCE") == "yes"
federate? = test_instance? or System.get_env("FEDERATE") == "yes"
config :tesla,
adapter: if(test_instance?, do: Tesla.Adapter.Hackney, else: Tesla.Mock)
adapter: if(federate?, do: {Tesla.Adapter.Finch, name: Bonfire.Finch}, else: Tesla.Mock)
oban_mode = if(test_instance?, do: :inline, else: :manual)
oban_mode = if(federate?, do: :inline, else: :manual)
config :bonfire, Oban, testing: oban_mode
config :activity_pub, Oban, testing: oban_mode

View file

@ -44,8 +44,9 @@ APP_BUILD := env_var_or_default('APP_BUILD', `git rev-parse --short HEAD || echo
CONFIG_PATH := FLAVOUR_PATH + "/config"
UID := `id -u`
GID := `id -g`
PUBLIC_PORT := env_var_or_default('PUBLIC_PORT', '4000')
PROXY_CADDYFILE_PATH := if env_var_or_default('PUBLIC_PORT', '4000') == "443" { "./config/deploy/Caddyfile2-https" } else { "./config/deploy/Caddyfile2" }
PROXY_CADDYFILE_PATH := if PUBLIC_PORT == "443" { "./config/deploy/Caddyfile2-https" } else { "./config/deploy/Caddyfile2" }
ENV_ENV := if MIX_ENV == "test" { "dev" } else { MIX_ENV }
@ -159,9 +160,8 @@ dev-proxied: docker-stop-web
dev-proxied-iex:
docker compose --profile proxy exec web iex --sname extra --remsh dev
dev-federate: docker-stop-web
which wg-quick || exit "You need to install Wireguard to run the tunnel/proxy. E.g. with: brew install wireguard-tools"
FEDERATE=yes HOSTNAME=$(([ -f tunnel.conf ] || curl https://tunnel.pyjam.as/4000 > tunnel.conf) && wg-quick up ./tunnel.conf | pcregrep -o1 'https:\/\/([^/]+)') PUBLIC_PORT=443 just dev
dev-federate:
FEDERATE=yes HOSTNAME=$(just local-tunnel-hostname) PUBLIC_PORT=443 just dev
dev-docker *args='': docker-stop-web
docker compose $args run --name $WEB_CONTAINER --service-ports web
@ -528,6 +528,9 @@ test-federation-dance *args='': test-federation-dance-positions
test-federation-dance-positions:
TEST_INSTANCE=yes MIX_ENV=test just mix deps.clean bonfire --build
test-federation-live *args='':
FEDERATE=yes START_SERVER=yes HOSTNAME=$(just local-tunnel-hostname) PUBLIC_PORT=443 just test-watch --only live_federation $@
# dev-test-watch: init ## Run tests
# docker compose run --service-ports -e MIX_ENV=test web iex -S mix phx.server
@ -814,3 +817,7 @@ nix-db-init: (nix-db "start")
sys-deps-debian:
./deps-debian.sh
local-tunnel-hostname:
command -v wg-quick &> /dev/null || exit "You need to install Wireguard to run the tunnel/proxy. E.g. with: brew install wireguard-tools"
([ -f tunnel.conf ] || curl https://tunnel.pyjam.as/{{PUBLIC_PORT}} > tunnel.conf) && (wg-quick up ./tunnel.conf || cat tunnel.conf) | pcregrep -o1 'https:\/\/([^/]+)'