返回 DeepSeek-Reasonix
mcp_concurrency_round_trip_test.go
根目录 / internal / config / mcp_concurrency_round_trip_test.go
1 package config
2
3 import (
4 "strings"
5 "testing"
6 )
7
8 // A safety policy that a config rewrite silently drops is worse than one that
9 // was never offered: the server quietly goes back to running in parallel.
10 func TestPluginConcurrencyRoundTripsThroughRender(t *testing.T) {
11 for _, scope := range []RenderScope{RenderScopeUser, RenderScopeProject} {
12 cfg := &Config{Plugins: []PluginEntry{{
13 Name: "browser",
14 Type: "stdio",
15 Command: "browser-mcp",
16 Concurrency: "serial",
17 }}}
18 rendered := RenderTOMLForScope(cfg, scope)
19 if !strings.Contains(rendered, `concurrency = "serial"`) {
20 t.Fatalf("scope %v dropped the concurrency policy:\n%s", scope, rendered)
21 }
22 var back Config
23 if _, err := decodeTOMLBytes([]byte(rendered), &back); err != nil {
24 t.Fatalf("reparse: %v", err)
25 }
26 if len(back.Plugins) != 1 || back.Plugins[0].Concurrency != "serial" {
27 t.Fatalf("scope %v round-trip lost the policy: %+v", scope, back.Plugins)
28 }
29 }
30 }
31
31 lines GO