Skip to content

Commit

Permalink
Added new test case for actor.Context.GetPID for search with tags. (#26)
Browse files Browse the repository at this point in the history
* fixed context.GetPID method for names without tags.

* added test for pid search with tags by actor.Context
  • Loading branch information
mczechyra authored Mar 5, 2023
1 parent 21b6c41 commit 2841b44
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions actor/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@ func TestGetByNameFromContext(t *testing.T) {
require.Equal(t, expectedPID.String(), pid.String())
}, "TransmitterFunc")
}

func TestGetByNameFromContextWithTags(t *testing.T) {
const PidName = "ReceiverFunc"

e := NewEngine()

// Receiver staless actor with given name:
e.SpawnFunc(func(c *Context) {}, PidName, WithTags("tag1", "tag2"))
time.Sleep(10 * time.Millisecond)

// Transmitter stateless actor which want to lookup receiver by his name:
e.SpawnFunc(func(c *Context) {
pid := c.GetPID(PidName, "tag1", "tag2")
require.NotNil(t, pid)

expectedPID := NewPID(LocalLookupAddr, PidName, "tag1", "tag2")
require.Equal(t, expectedPID.String(), pid.String())
}, "TransmitterFunc")
}

0 comments on commit 2841b44

Please sign in to comment.