@@ -23,8 +23,6 @@ max_myses = 32
2323 endpoint = "http://custom:11434"
2424 model = "mistral"
2525 temperature = 0.7
26-rate_limit = 2.0
27-rate_burst = 3
2826
2927 [mcp]
3028 upstream = "https://custom.mcp/endpoint"
@@ -61,8 +59,6 @@ max_myses = 16
6159 endpoint = "http://localhost:11434"
6260 model = "qwen3:4b"
6361 temperature = 0.5
64-rate_limit = 2.0
65-rate_burst = 3
6662 `
6763 if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
6864 t.Fatalf("failed to write test config: %v", err)
@@ -78,38 +74,6 @@ rate_burst = 3
7874 }
7975 }
8076
81-func TestLoadWithRateLimit(t *testing.T) {
82- tmpDir := t.TempDir()
83- configPath := filepath.Join(tmpDir, "config.toml")
84-
85- content := `
86-[swarm]
87-max_myses = 16
88-
89-[providers.ollama]
90-endpoint = "http://localhost:11434"
91-model = "qwen3:4b"
92-temperature = 0.7
93-rate_limit = 3.5
94-rate_burst = 4
95-`
96- if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
97- t.Fatalf("failed to write test config: %v", err)
98- }
99-
100- cfg, err := Load(configPath)
101- if err != nil {
102- t.Fatalf("Load() error: %v", err)
103- }
104-
105- if cfg.Providers["ollama"].RateLimit != 3.5 {
106- t.Errorf("expected rate_limit=3.5, got %v", cfg.Providers["ollama"].RateLimit)
107- }
108- if cfg.Providers["ollama"].RateBurst != 4 {
109- t.Errorf("expected rate_burst=4, got %d", cfg.Providers["ollama"].RateBurst)
110- }
111-}
112-
11377 func TestLoadInvalidTemperature(t *testing.T) {
11478 tmpDir := t.TempDir()
11579 configPath := filepath.Join(tmpDir, "config.toml")
@@ -170,8 +134,6 @@ max_myses = 16
170134 endpoint = "http://localhost:11434"
171135 model = "qwen3:4b"
172136 temperature = 0.7
173-rate_limit = 2.0
174-rate_burst = 3
175137
176138 [mcp]
177139 upstream = "https://default.mcp/endpoint"
@@ -290,8 +252,6 @@ max_myses = 16
290252 endpoint = "http://file-endpoint"
291253 model = "file-model"
292254 temperature = 0.7
293-rate_limit = 2.0
294-rate_burst = 3
295255 `
296256 if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
297257 t.Fatalf("failed to write test config: %v", err)
@@ -328,8 +288,6 @@ max_myses = 16
328288 endpoint = "http://localhost:11434"
329289 model = "qwen3:8b"
330290 temperature = 0.7
331-rate_limit = 2.0
332-rate_burst = 3
333291 `
334292 if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
335293 t.Fatalf("failed to write test config: %v", err)
@@ -451,85 +409,6 @@ model = "qwen3:4b"
451409 }
452410 }
453411
454-func TestLoadRateLimitBounds(t *testing.T) {
455- tmpDir := t.TempDir()
456- configPath := filepath.Join(tmpDir, "config.toml")
457-
458- tests := []struct {
459- name string
460- rateLimit float64
461- }{
462- {"zero", 0.0},
463- {"negative", -1.0},
464- {"negative_fraction", -0.5},
465- }
466-
467- for _, tt := range tests {
468- t.Run(tt.name, func(t *testing.T) {
469- content := fmt.Sprintf(`
470-[providers.ollama]
471-endpoint = "http://localhost:11434"
472-model = "qwen3:4b"
473-rate_limit = %v
474-`, tt.rateLimit)
475-
476- if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
477- t.Fatalf("failed to write test config: %v", err)
478- }
479-
480- _, err := Load(configPath)
481- if err == nil {
482- t.Fatal("expected validation error for rate_limit <= 0")
483- }
484- if !strings.Contains(err.Error(), "rate_limit") {
485- t.Fatalf("expected rate_limit validation error, got %v", err)
486- }
487- if !strings.Contains(err.Error(), "must be greater than 0") {
488- t.Fatalf("expected bounds message, got %v", err)
489- }
490- })
491- }
492-}
493-
494-func TestLoadRateBurstBounds(t *testing.T) {
495- tmpDir := t.TempDir()
496- configPath := filepath.Join(tmpDir, "config.toml")
497-
498- tests := []struct {
499- name string
500- rateBurst int
501- }{
502- {"zero", 0},
503- {"negative", -1},
504- }
505-
506- for _, tt := range tests {
507- t.Run(tt.name, func(t *testing.T) {
508- content := fmt.Sprintf(`
509-[providers.ollama]
510-endpoint = "http://localhost:11434"
511-model = "qwen3:4b"
512-rate_burst = %d
513-`, tt.rateBurst)
514-
515- if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
516- t.Fatalf("failed to write test config: %v", err)
517- }
518-
519- _, err := Load(configPath)
520- if err == nil {
521- t.Fatal("expected validation error for rate_burst < 1")
522- }
523- if !strings.Contains(err.Error(), "rate_burst") {
524- t.Fatalf("expected rate_burst validation error, got %v", err)
525- }
526- if !strings.Contains(err.Error(), "must be at least 1") {
527- t.Fatalf("expected bounds message, got %v", err)
528- }
529- })
530- }
531-}
532-
533412 func TestLoadDefaultProvider(t *testing.T) {
534413 tmpDir := t.TempDir()
535414 configPath := filepath.Join(tmpDir, "config.toml")
@@ -543,8 +422,6 @@ default_provider = "ollama-qwen"
543422 endpoint = "http://localhost:11434"
544423 model = "qwen3:8b"
545424 temperature = 0.7
546-rate_limit = 2.0
547-rate_burst = 3
548425 `
549426 if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil {
550427 t.Fatalf("failed to write test config: %v", err)
@@ -572,8 +449,6 @@ max_myses = 16
572449 endpoint = "http://localhost:11434"
573450 model = "qwen3:8b"
574451 temperature = 0.7
575-rate_limit = 2.0
576-rate_burst = 3
577452
578453 [mcp]
579454 upstream = "https://mcp.example.com"
@@ -616,8 +491,6 @@ max_myses = 16
616491 endpoint = "http://localhost:11434"
617492 model = "qwen3:8b"
618493 temperature = 0.7
619-rate_limit = 2.0
620-rate_burst = 3
621494 `
622495 if err := os.WriteFile(configPath, []byte(content), 0644); err != nil {
623496 t.Fatalf("failed to write test config: %v", err)