Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package agentruntime
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestClaudeCodeSDKAdapterCloseHonorsContextWhileSendGateIsHeld(t *testing.T) {
|
|
adapter := NewClaudeCodeSDKAdapter(nil)
|
|
connection := &recordingClaudeSDKConnection{}
|
|
session := standardTestSession(ProviderClaudeCode)
|
|
adapterSession := &claudeSDKAdapterSession{
|
|
conn: connection,
|
|
readerStarted: true,
|
|
pendingResponses: make(map[string]chan claudeSDKSidecarEvent),
|
|
}
|
|
adapter.storeSession(session.AgentSessionID, adapterSession)
|
|
|
|
adapterSession.sendMu.Lock()
|
|
defer adapterSession.sendMu.Unlock()
|
|
ctx, cancel := context.WithTimeout(t.Context(), 25*time.Millisecond)
|
|
defer cancel()
|
|
|
|
startedAt := time.Now()
|
|
err := adapter.Close(ctx, session)
|
|
if !errors.Is(err, context.DeadlineExceeded) {
|
|
t.Fatalf("Close() error = %v, want context deadline exceeded", err)
|
|
}
|
|
if elapsed := time.Since(startedAt); elapsed > time.Second {
|
|
t.Fatalf("Close() elapsed = %v, want bounded by context", elapsed)
|
|
}
|
|
if sent := connection.sentRequests(); len(sent) != 0 {
|
|
t.Fatalf("Close() sent requests after deadline: %#v", sent)
|
|
}
|
|
}
|