MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestStartFailsWhenConfigMissing

Function TestStartFailsWhenConfigMissing

internal/watcher/watcher_test.go:264–284  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

262}
263
264func TestStartFailsWhenConfigMissing(t *testing.T) {
265 tmpDir := t.TempDir()
266 authDir := filepath.Join(tmpDir, "auth")
267 if err := os.MkdirAll(authDir, 0o755); err != nil {
268 t.Fatalf("failed to create auth dir: %v", err)
269 }
270 configPath := filepath.Join(tmpDir, "missing-config.yaml")
271
272 w, err := NewWatcher(configPath, authDir, nil)
273 if err != nil {
274 t.Fatalf("failed to create watcher: %v", err)
275 }
276 defer w.Stop()
277
278 ctx, cancel := context.WithCancel(context.Background())
279 defer cancel()
280
281 if err := w.Start(ctx); err == nil {
282 t.Fatal("expected Start to fail for missing config file")
283 }
284}
285
286func TestDispatchRuntimeAuthUpdateEnqueuesAndUpdatesState(t *testing.T) {
287 queue := make(chan AuthUpdate, 4)

Callers

nothing calls this directly

Calls 3

StopMethod · 0.95
StartMethod · 0.95
NewWatcherFunction · 0.85

Tested by

no test coverage detected