diff --git a/test/integration.go b/test/integration.go index fd96230e..670b5bbf 100644 --- a/test/integration.go +++ b/test/integration.go @@ -225,7 +225,7 @@ func (r *Runner) startEgress(t *testing.T, req *rpc.StartEgressRequest) string { func (r *Runner) sendRequest(t *testing.T, req *rpc.StartEgressRequest) *livekit.EgressInfo { // send start request - info, err := r.client.StartEgress(context.Background(), "", req) + info, err := r.start(context.Background(), req) // check returned egress info require.NoError(t, err) diff --git a/test/integration_test.go b/test/integration_test.go index 1f96c9a4..9430a0a0 100644 --- a/test/integration_test.go +++ b/test/integration_test.go @@ -51,5 +51,6 @@ func TestEgress(t *testing.T) { svc, err := server.NewServer(r.ServiceConfig, bus, ioClient) require.NoError(t, err) - r.Run(t, svc, bus, rfs) + r.StartServer(t, svc, bus, rfs) + r.RunTests(t) } diff --git a/test/room_composite.go b/test/room_composite.go index 07c5f77a..3ae8c149 100644 --- a/test/room_composite.go +++ b/test/room_composite.go @@ -169,7 +169,7 @@ func (r *Runner) testRoomCompositeStream(t *testing.T) { }, } - info, err := r.client.StartEgress(context.Background(), "", req) + info, err := r.start(context.Background(), req) require.NoError(t, err) require.Empty(t, info.Error) require.NotEmpty(t, info.EgressId) diff --git a/test/runner.go b/test/runner.go index 9b6a1452..091a4c77 100644 --- a/test/runner.go +++ b/test/runner.go @@ -17,6 +17,7 @@ package test import ( + "context" "encoding/json" "fmt" "io/fs" @@ -38,6 +39,8 @@ import ( ) type Runner struct { + StartEgress func(ctx context.Context, request *rpc.StartEgressRequest) (*livekit.EgressInfo, error) `yaml:"-"` + svc Server `yaml:"-"` client rpc.EgressClient `yaml:"-"` room *lksdk.Room `yaml:"-"` @@ -154,7 +157,7 @@ func NewRunner(t *testing.T) *Runner { return r } -func (r *Runner) Run(t *testing.T, svc Server, bus psrpc.MessageBus, templateFs fs.FS) { +func (r *Runner) StartServer(t *testing.T, svc Server, bus psrpc.MessageBus, templateFs fs.FS) { lksdk.SetLogger(logger.LogRLogger(logr.Discard())) r.svc = svc t.Cleanup(func() { @@ -177,6 +180,9 @@ func (r *Runner) Run(t *testing.T, svc Server, bus psrpc.MessageBus, templateFs psrpcClient, err := rpc.NewEgressClient(rpc.ClientParams{Bus: bus}) require.NoError(t, err) + r.StartEgress = func(ctx context.Context, req *rpc.StartEgressRequest) (*livekit.EgressInfo, error) { + return psrpcClient.StartEgress(ctx, "", req) + } // start templates handler err = r.svc.StartTemplatesServer(templateFs) @@ -201,7 +207,9 @@ func (r *Runner) Run(t *testing.T, svc Server, bus psrpc.MessageBus, templateFs require.Len(t, status, 1) require.Contains(t, status, "CpuLoad") } +} +func (r *Runner) RunTests(t *testing.T) { // run tests r.testRoomComposite(t) r.testWeb(t)