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

Function TestLoadFileClientsWalkError

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

Source from the content-addressed store, hash-verified

1268}
1269
1270func TestLoadFileClientsWalkError(t *testing.T) {
1271 tmpDir := t.TempDir()
1272 noAccessDir := filepath.Join(tmpDir, "0noaccess")
1273 if err := os.MkdirAll(noAccessDir, 0o755); err != nil {
1274 t.Fatalf("failed to create noaccess dir: %v", err)
1275 }
1276 if err := os.Chmod(noAccessDir, 0); err != nil {
1277 t.Skipf("chmod not supported: %v", err)
1278 }
1279 defer func() { _ = os.Chmod(noAccessDir, 0o755) }()
1280
1281 cfg := &config.Config{AuthDir: tmpDir}
1282 w := &Watcher{}
1283 w.SetConfig(cfg)
1284
1285 count := w.loadFileClients(cfg)
1286 if count != 0 {
1287 t.Fatalf("expected count 0 due to walk error, got %d", count)
1288 }
1289}
1290
1291func TestReloadConfigIfChangedHandlesMissingAndEmpty(t *testing.T) {
1292 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 2

SetConfigMethod · 0.95
loadFileClientsMethod · 0.95

Tested by

no test coverage detected