Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker/postgres/init/002-fmsgd-dd.sql
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,4 @@ drop trigger if exists trg_msg_add_to_insert on msg_add_to;
create trigger trg_msg_add_to_insert
after insert on msg_add_to
for each row execute function notify_msg_to_insert();

8 changes: 3 additions & 5 deletions test/tests/001-send-message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ set -euo pipefail
echo " Sending message: @alice@hairpin.local → @bob@example.com"
export FMSG_API_URL="$HAIRPIN_API_URL"
printf '@alice@hairpin.local\n' | fmsg login
sleep 3
fmsg send '@bob@example.com' "Hello Bob, this is an integration test."

echo " Waiting for cross-instance delivery..."
sleep 5

echo " Reading messages as @bob@example.com"
export FMSG_API_URL="$EXAMPLE_API_URL"
printf '@bob@example.com\n' | fmsg login
sleep 3
fmsg wait --timeout 15 >/dev/null

echo " Reading messages as @bob@example.com"
MSG_OUTPUT=$(fmsg list)
echo "$MSG_OUTPUT"

Expand Down
8 changes: 3 additions & 5 deletions test/tests/002-reply-message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ set -euo pipefail
echo " Sending reply: @bob@example.com → @alice@hairpin.local (pid 1)"
export FMSG_API_URL="$EXAMPLE_API_URL"
printf '@bob@example.com\n' | fmsg login
sleep 3
fmsg send --pid 1 '@alice@hairpin.local' "Hey there Alice, got your message!"

echo " Waiting for cross-instance delivery..."
sleep 5

echo " Reading messages as @alice@hairpin.local"
export FMSG_API_URL="$HAIRPIN_API_URL"
printf '@alice@hairpin.local\n' | fmsg login
sleep 3
fmsg wait --timeout 15 >/dev/null

echo " Reading messages as @alice@hairpin.local"
MSG_OUTPUT=$(fmsg list)
echo "$MSG_OUTPUT"

Expand Down
1 change: 0 additions & 1 deletion test/tests/003-reply-invalid-pid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -euo pipefail
echo " Sending reply with invalid pid 99: @bob@example.com → @alice@hairpin.local"
export FMSG_API_URL="$EXAMPLE_API_URL"
printf '@bob@example.com\n' | fmsg login
sleep 3

if fmsg send --pid 99 '@alice@hairpin.local' "This should fail" 2>/dev/null; then
echo " FAIL: send with invalid pid 99 succeeded but should have failed"
Expand Down
11 changes: 3 additions & 8 deletions test/tests/004-add-to-recipient.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ set -euo pipefail
echo " Sending initial message: @alice@hairpin.local → @bob@example.com"
export FMSG_API_URL="$HAIRPIN_API_URL"
printf '@alice@hairpin.local\n' | fmsg login
sleep 3
fmsg send '@bob@example.com' "Hello Bob, this is the add-to integration test."

echo " Waiting for delivery..."
sleep 3

echo " Getting message ID from alice's sent messages"
MSG_ID=$(fmsg list | grep -oE '\b[0-9]+\b' | head -1)
if [ -z "$MSG_ID" ]; then
Expand All @@ -25,12 +21,11 @@ echo " Adding @carol@example.com as recipient via add-to $MSG_ID"
fmsg add-to "$MSG_ID" '@carol@example.com'

echo " Waiting for cross-instance delivery..."
sleep 3

echo " Reading messages as @carol@example.com"
export FMSG_API_URL="$EXAMPLE_API_URL"
printf '@carol@example.com\n' | fmsg login
sleep 3
fmsg wait --timeout 15 >/dev/null

echo " Reading messages as @carol@example.com"
MSG_OUTPUT=$(fmsg list)
echo "$MSG_OUTPUT"

Expand Down
Loading