(t *testing.T)
| 1268 | } |
| 1269 | |
| 1270 | func 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 | |
| 1291 | func TestReloadConfigIfChangedHandlesMissingAndEmpty(t *testing.T) { |
| 1292 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected