TestReload_FirstBootPath verifies that the first-boot call site (agent.go) can be routed through Reload without behavioral change.
(t *testing.T)
| 616 | // TestReload_FirstBootPath verifies that the first-boot call site |
| 617 | // (agent.go) can be routed through Reload without behavioral change. |
| 618 | func TestReload_FirstBootPath(t *testing.T) { |
| 619 | t.Parallel() |
| 620 | |
| 621 | if os.Getenv("TEST_MCP_FAKE_SERVER") == "1" { |
| 622 | runFakeMCPServer() |
| 623 | return |
| 624 | } |
| 625 | |
| 626 | ctx := testutil.Context(t, testutil.WaitLong) |
| 627 | logger := slogtest.Make(t, nil).Leveled(slog.LevelDebug) |
| 628 | dir := t.TempDir() |
| 629 | |
| 630 | _, entry := fakeMCPServerConfig(t, "srv") |
| 631 | configPath := writeMCPConfig(t, dir, map[string]mcpServerEntry{"srv": entry}) |
| 632 | |
| 633 | m := NewManager(ctx, logger, agentexec.DefaultExecer, nil) |
| 634 | t.Cleanup(func() { _ = m.Close() }) |
| 635 | |
| 636 | // Simulate first-boot: Reload with the initial config. |
| 637 | err := m.Reload(ctx, []string{configPath}) |
| 638 | require.NoError(t, err) |
| 639 | |
| 640 | tools := m.cachedTools() |
| 641 | require.Len(t, tools, 1) |
| 642 | assert.Contains(t, tools[0].Name, "echo") |
| 643 | } |
| 644 | |
| 645 | // TestReload_NoopWhenUnchanged verifies that Reload returns |
| 646 | // immediately without reconnecting when the snapshot is fresh. |
nothing calls this directly
no test coverage detected