| 460 | } |
| 461 | |
| 462 | func (m *fakeSubAgentClient) Delete(ctx context.Context, id uuid.UUID) error { |
| 463 | m.logger.Debug(ctx, "deleting sub agent", slog.F("id", id.String())) |
| 464 | if m.deleteErrC != nil { |
| 465 | select { |
| 466 | case <-ctx.Done(): |
| 467 | return ctx.Err() |
| 468 | case err := <-m.deleteErrC: |
| 469 | if err != nil { |
| 470 | return err |
| 471 | } |
| 472 | } |
| 473 | } |
| 474 | m.mu.Lock() |
| 475 | defer m.mu.Unlock() |
| 476 | if m.agents == nil { |
| 477 | m.agents = make(map[uuid.UUID]agentcontainers.SubAgent) |
| 478 | } |
| 479 | delete(m.agents, id) |
| 480 | m.deleted = append(m.deleted, id) |
| 481 | return nil |
| 482 | } |
| 483 | |
| 484 | // fakeExecer implements agentexec.Execer for testing and tracks execution details. |
| 485 | type fakeExecer struct { |