-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* moves existing tests to use assert package; moves helper functions to test package * update goakt Signed-off-by: Jordan Rash <jordan@synadia.com>
- Loading branch information
1 parent
c7a4459
commit b0115bf
Showing
15 changed files
with
539 additions
and
350 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package actors | ||
|
||
import ( | ||
"context" | ||
"io" | ||
"log/slog" | ||
"testing" | ||
"time" | ||
|
||
"github.com/synadia-io/nex/models" | ||
actorproto "github.com/synadia-io/nex/node/internal/actors/pb" | ||
|
||
"github.com/tochemey/goakt/v2/testkit" | ||
) | ||
|
||
func TestAgentSupervisor(t *testing.T) { | ||
ctx := context.Background() | ||
|
||
as := &AgentSupervisor{ | ||
logger: slog.New(slog.NewTextHandler(io.Discard, nil)), | ||
nodeOptions: models.NodeOptions{}, | ||
} | ||
|
||
tk := testkit.New(ctx, t) | ||
t.Run("Send QueryWorkloads Message", func(t *testing.T) { | ||
tk.Spawn(ctx, AgentSupervisorActorName, as) | ||
probe := tk.NewProbe(ctx) | ||
msg := new(actorproto.QueryWorkloads) | ||
probe.SendSync(AgentSupervisorActorName, msg, time.Second) | ||
resp := &actorproto.WorkloadList{ | ||
Workloads: []*actorproto.WorkloadSummary{}, | ||
} | ||
probe.ExpectMessage(resp) | ||
probe.ExpectNoMessage() | ||
probe.Stop() | ||
}) | ||
|
||
t.Run("Send SetLameDuck Message", func(t *testing.T) { | ||
tk.Spawn(ctx, AgentSupervisorActorName, as) | ||
probe := tk.NewProbe(ctx) | ||
msg := new(actorproto.SetLameDuck) | ||
probe.Send(AgentSupervisorActorName, msg) | ||
probe.ExpectNoMessage() | ||
probe.Stop() | ||
}) | ||
|
||
t.Cleanup(func() { | ||
tk.Shutdown(ctx) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.