Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions go/test/e2e/invoke_api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,6 @@ func runSyncTest(t *testing.T, a2aClient *a2aclient.A2AClient, userMessage, expe
// If contextID is provided, it will be included in the message to maintain conversation context
// Checks the full JSON output to support both artifacts and history from different agent types
func runStreamingTest(t *testing.T, a2aClient *a2aclient.A2AClient, userMessage, expectedText string, contextID ...string) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()

msg := protocol.Message{
Kind: protocol.KindMessage,
Role: protocol.MessageRoleUser,
Expand All @@ -255,15 +252,24 @@ func runStreamingTest(t *testing.T, a2aClient *a2aclient.A2AClient, userMessage,
msg.ContextID = &contextID[0]
}

var stream <-chan protocol.StreamingMessageEvent
var (
stream <-chan protocol.StreamingMessageEvent
ctx context.Context
cancel context.CancelFunc
)
err := retry.OnError(defaultRetry, func(err error) bool {
return err != nil
}, func() error {
var retryErr error
ctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)
stream, retryErr = a2aClient.StreamMessage(ctx, protocol.SendMessageParams{Message: msg})
if retryErr != nil {
cancel()
}
return retryErr
})
require.NoError(t, err)
defer cancel()

resultList := []protocol.StreamingMessageEvent{}
var text string
Expand Down Expand Up @@ -462,11 +468,6 @@ func TestE2EInvokeInlineAgentWithStreaming(t *testing.T) {
// Enable streaming explicitly
agent := setupAgentWithOptions(t, cli, modelCfg.Name, tools, AgentOptions{Stream: true})

defer func() {
cli.Delete(t.Context(), agent) //nolint:errcheck
cli.Delete(t.Context(), modelCfg) //nolint:errcheck
}()

// Setup A2A client
a2aClient := setupA2AClient(t, agent)

Expand Down
Loading