github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/router/config_test.go (about)

     1  package router
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/asynkron/protoactor-go/actor"
     7  	"github.com/stretchr/testify/assert"
     8  )
     9  
    10  func TestSpawn(t *testing.T) {
    11  	pr := &broadcastPoolRouter{PoolRouter{PoolSize: 1}}
    12  	pid, err := spawn(system, "foo", pr, actor.PropsFromFunc(func(context actor.Context) {}), system.Root)
    13  	assert.NoError(t, err)
    14  
    15  	_, exists := system.ProcessRegistry.Get(system.NewLocalPID("foo/router"))
    16  	assert.True(t, exists)
    17  
    18  	err = system.Root.StopFuture(pid).Wait()
    19  	assert.NoError(t, err)
    20  
    21  	_, exists = system.ProcessRegistry.Get(system.NewLocalPID("foo/router"))
    22  	assert.False(t, exists)
    23  }