TestBootstrapTightensLooseDirPerms: a .codehamr/ created loose (older release, or by hand at 0o755) must be tightened on the next Bootstrap, the directory counterpart of Save's fresh-temp-inode fix for config.yaml.
(t *testing.T)
| 349 | // release, or by hand at 0o755) must be tightened on the next Bootstrap, the |
| 350 | // directory counterpart of Save's fresh-temp-inode fix for config.yaml. |
| 351 | func TestBootstrapTightensLooseDirPerms(t *testing.T) { |
| 352 | root := t.TempDir() |
| 353 | dir := filepath.Join(root, DirName) |
| 354 | if err := os.MkdirAll(dir, 0o755); err != nil { |
| 355 | t.Fatal(err) |
| 356 | } |
| 357 | if err := os.Chmod(dir, 0o755); err != nil { // bypass umask |
| 358 | t.Fatal(err) |
| 359 | } |
| 360 | if _, _, err := Bootstrap(root); err != nil { |
| 361 | t.Fatal(err) |
| 362 | } |
| 363 | st, err := os.Stat(dir) |
| 364 | if err != nil { |
| 365 | t.Fatal(err) |
| 366 | } |
| 367 | if got := st.Mode().Perm(); got != 0o700 { |
| 368 | t.Fatalf("pre-existing loose .codehamr/ = %v after Bootstrap, want 0o700", got) |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | // TestSaveIsAtomicAndLeavesNoTemp: writeYAML writes a sibling temp then renames |
| 373 | // it over config.yaml so a torn write can't brick the next launch. Pin that the |
nothing calls this directly
no test coverage detected