(t *testing.T)
| 123 | } |
| 124 | |
| 125 | func 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 | |
| 143 | func TestNFSClientSetupMountNFSDirIncludesMountStderr(t *testing.T) { |
| 144 | binDir := t.TempDir() |
nothing calls this directly
no test coverage detected