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

Function TestNFSClientSetupRemoveFSTabEntry

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

Source from the content-addressed store, hash-verified

123}
124
125func TestNFSClientSetupRemoveFSTabEntry(t *testing.T) {
126 fstabPath := filepath.Join(t.TempDir(), "fstab")
127 if err := os.WriteFile(fstabPath, []byte("server:/exports/cache /mnt/cache nfs rw,_netdev,noatime,rsize=1048576,wsize=1048576 0 0\nserver:/exports/other /mnt/other nfs rw,_netdev 0 0\n"), 0644); err != nil {
128 t.Fatal(err)
129 }
130
131 oldNFSFSTabPath := nfsFSTabPath
132 nfsFSTabPath = fstabPath
133 t.Cleanup(func() { nfsFSTabPath = oldNFSFSTabPath })
134
135 setup := NewNFSClientSetup("/mnt/cache@server:/exports/cache")
136 if err := setup.removeFSTabEntry("server:/exports/cache", "/mnt/cache"); err != nil {
137 t.Fatal(err)
138 }
139
140 assertFileContent(t, fstabPath, "server:/exports/other /mnt/other nfs rw,_netdev 0 0\n")
141}
142
143func TestNFSClientSetupMountNFSDirIncludesMountStderr(t *testing.T) {
144 binDir := t.TempDir()

Callers

nothing calls this directly

Calls 4

removeFSTabEntryMethod · 0.95
NewNFSClientSetupFunction · 0.85
WriteFileMethod · 0.80
assertFileContentFunction · 0.70

Tested by

no test coverage detected