Skip to content

Commit

Permalink
we cannot test the default deadletter handling as there is no handlin…
Browse files Browse the repository at this point in the history
…g of it in the default.
  • Loading branch information
perbu committed Dec 6, 2023
1 parent 1c43960 commit ba84b41
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions actor/deadletter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,10 @@ package actor
import (
"bytes"
"github.com/stretchr/testify/assert"
"log/slog"
"sync"
"testing"
"time"
)

// TestDeadLetterDefault tests the default deadletter handling.
// It will spawn a new actor, kill it, send a message to it and then check if there is a message
// logged to the default logger
func TestDeadLetterDefault(t *testing.T) {
logBuffer := SafeBuffer{}
logger := slog.New(slog.NewTextHandler(&logBuffer, &slog.HandlerOptions{Level: slog.LevelDebug}))
slog.SetDefault(logger)
e, err := NewEngine()
assert.NoError(t, err)
e.Send(invalidPid(), "bar") // should end up the deadletter queue
time.Sleep(time.Millisecond) // wait for the deadletter to be processed
// check the log buffer for the deadletter
assert.Contains(t, logBuffer.String(), "deadletter arrived")
}

// TestDeadLetterCustom tests the custom deadletter handling.
// It is using the custom deadletter receiver defined inline.
func TestDeadLetterCustom(t *testing.T) {
Expand Down

0 comments on commit ba84b41

Please sign in to comment.