(t *testing.T)
| 82 | } |
| 83 | |
| 84 | func TestNFSServerSetupRemoveNFSExportEntry(t *testing.T) { |
| 85 | exportsPath := filepath.Join(t.TempDir(), "exports") |
| 86 | if err := os.WriteFile(exportsPath, []byte("/srv/celer-cache *(rw,sync,no_subtree_check,no_root_squash)\n/srv/other *(rw,sync)\n"), 0644); err != nil { |
| 87 | t.Fatal(err) |
| 88 | } |
| 89 | |
| 90 | oldNFSExportsPath := nfsExportsPath |
| 91 | nfsExportsPath = exportsPath |
| 92 | t.Cleanup(func() { nfsExportsPath = oldNFSExportsPath }) |
| 93 | |
| 94 | setup := NewNFSServerSetup("/srv/celer-cache") |
| 95 | if err := setup.removeNFSExportEntry(); err != nil { |
| 96 | t.Fatal(err) |
| 97 | } |
| 98 | |
| 99 | assertFileContent(t, exportsPath, "/srv/other *(rw,sync)\n") |
| 100 | } |
| 101 | |
| 102 | func TestNFSServerSetupRemoveChattrCronJob(t *testing.T) { |
| 103 | cronDir := t.TempDir() |
nothing calls this directly
no test coverage detected