- Add unbounded CLI sessions agent-task with plan and code review logs - Add edge console with tests - Add node run manager for session lifecycle management - Add router and store tests - Update transport session handling - Add runtime proto definitions - Update configurations and packages
33 lines
630 B
Go
33 lines
630 B
Go
package transport_test
|
|
|
|
import (
|
|
"context"
|
|
"sync"
|
|
"testing"
|
|
|
|
"iop/apps/node/internal/transport"
|
|
iop "iop/proto/gen/iop"
|
|
)
|
|
|
|
type noopHandler struct{}
|
|
|
|
func (h *noopHandler) OnRunRequest(_ context.Context, _ *transport.Session, _ *iop.RunRequest) error {
|
|
return nil
|
|
}
|
|
func (h *noopHandler) OnCancel(_ context.Context, _ *transport.Session, _ *iop.CancelRequest) error {
|
|
return nil
|
|
}
|
|
|
|
func TestSession_SetHandler_ConcurrentSafe(t *testing.T) {
|
|
var s transport.Session
|
|
var wg sync.WaitGroup
|
|
h := &noopHandler{}
|
|
for i := 0; i < 50; i++ {
|
|
wg.Add(1)
|
|
go func() {
|
|
defer wg.Done()
|
|
s.SetHandler(h)
|
|
}()
|
|
}
|
|
wg.Wait()
|
|
}
|