(t *testing.T)
| 251 | } |
| 252 | |
| 253 | func TestManager_WaitReloadTimeout(t *testing.T) { |
| 254 | t.Parallel() |
| 255 | |
| 256 | ctx := testutil.Context(t, testutil.WaitLong) |
| 257 | logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug) |
| 258 | clock := quartz.NewMock(t) |
| 259 | timerTrap := clock.Trap().NewTimer("agentmcp", "tools_reload") |
| 260 | defer timerTrap.Close() |
| 261 | |
| 262 | m := NewManager(ctx, logger, agentexec.DefaultExecer, nil) |
| 263 | m.clock = clock |
| 264 | t.Cleanup(func() { _ = m.Close() }) |
| 265 | |
| 266 | done := make(chan error, 1) |
| 267 | go func() { |
| 268 | done <- m.waitReload(ctx, make(chan reloadResult), time.Minute) |
| 269 | }() |
| 270 | |
| 271 | call := timerTrap.MustWait(ctx) |
| 272 | require.Equal(t, time.Minute, call.Duration) |
| 273 | call.MustRelease(ctx) |
| 274 | |
| 275 | clock.Advance(time.Minute).MustWait(ctx) |
| 276 | err := testutil.RequireReceive(ctx, t, done) |
| 277 | require.Error(t, err) |
| 278 | assert.ErrorIs(t, err, context.DeadlineExceeded) |
| 279 | assert.Contains(t, err.Error(), "tools reload timed out after 1m0s") |
| 280 | } |
| 281 | |
| 282 | func TestManager_ToolsStartupGate(t *testing.T) { |
| 283 | t.Parallel() |
nothing calls this directly
no test coverage detected