MCPcopy Index your code
hub / github.com/celer-pkg/celer / TestNFSServerSetupRemoveNFSExportEntry

Function TestNFSServerSetupRemoveNFSExportEntry

pkgcache/cache_setup_test.go:84–100  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func 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
102func TestNFSServerSetupRemoveChattrCronJob(t *testing.T) {
103 cronDir := t.TempDir()

Callers

nothing calls this directly

Calls 4

removeNFSExportEntryMethod · 0.95
NewNFSServerSetupFunction · 0.85
WriteFileMethod · 0.80
assertFileContentFunction · 0.70

Tested by

no test coverage detected