Skip to content

Commit 00be9e6

Browse files
committed
update. lsshfs debug now
1 parent 0ac4680 commit 00be9e6

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

demo/e2e_test.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ func testDemoProxyAndForwarding(t *testing.T, demoDir string) {
181181
})
182182

183183
t.Run("lsshfs mounts remote path locally and can unmount it", func(t *testing.T) {
184-
startDemoLsshfsMount(t, demoDir, "@KeyAuth:/home/demo", "/home/demo/mnt/lsshfs", "/tmp/lsshfs-demo.log")
184+
startDemoLsshfsMount(t, demoDir, "@KeyAuth:/home/demo", "/home/demo/mnt/lsshfs", "/tmp/lsshfs-demo.log", "/tmp/lsshfs-demo.pid")
185185

186186
assertClientCommandContains(t, demoDir,
187187
"grep -F '/home/demo/mnt/lsshfs' /proc/mounts && grep -F '/home/demo/mnt/lsshfs' <(lsshfs --list-mounts)",
@@ -196,7 +196,7 @@ func testDemoProxyAndForwarding(t *testing.T, demoDir string) {
196196
})
197197

198198
t.Run("lsshfs mounted directory can be traversed without hanging", func(t *testing.T) {
199-
startDemoLsshfsMount(t, demoDir, "@KeyAuth:/home/demo", "/home/demo/mnt/lsshfs", "/tmp/lsshfs-demo-interaction.log")
199+
startDemoLsshfsMount(t, demoDir, "@KeyAuth:/home/demo", "/home/demo/mnt/lsshfs", "/tmp/lsshfs-demo-interaction.log", "/tmp/lsshfs-demo-interaction.pid")
200200
t.Cleanup(func() {
201201
_, _ = runClientCommand(demoDir, "lsshfs --unmount /home/demo/mnt/lsshfs")
202202
})
@@ -209,7 +209,7 @@ func testDemoProxyAndForwarding(t *testing.T, demoDir string) {
209209

210210
t.Run("lsshfs rejects missing remote paths", func(t *testing.T) {
211211
output, err := runClientCommand(demoDir,
212-
"mkdir -p /home/demo/mnt/lsshfs-missing && lsshfs @KeyAuth:/home/demo/does-not-exist /home/demo/mnt/lsshfs-missing",
212+
"mkdir -p /home/demo/mnt/lsshfs-missing && lsshfs --foreground @KeyAuth:/__lssh_missing__/does-not-exist /home/demo/mnt/lsshfs-missing",
213213
)
214214
if err == nil {
215215
t.Fatalf("expected lsshfs missing path mount to fail\noutput:\n%s", output)
@@ -429,11 +429,16 @@ func runClientCommand(demoDir, command string) (string, error) {
429429
return string(output), nil
430430
}
431431

432-
func startDemoLsshfsMount(t *testing.T, demoDir, remotePath, mountPoint, logPath string) {
432+
func startDemoLsshfsMount(t *testing.T, demoDir, remotePath, mountPoint, logPath, pidPath string) {
433433
t.Helper()
434434

435+
stopClientForward(t, demoDir, pidPath)
436+
t.Cleanup(func() {
437+
stopClientForward(t, demoDir, pidPath)
438+
})
439+
435440
runClientCommandOrFail(t, demoDir,
436-
fmt.Sprintf("mkdir -p %s && lsshfs %s %s >%s 2>&1", mountPoint, remotePath, mountPoint, logPath),
441+
fmt.Sprintf("mkdir -p %s && nohup lsshfs --foreground %s %s >%s 2>&1 & echo $! > %s", mountPoint, remotePath, mountPoint, logPath, pidPath),
437442
)
438443

439444
deadline := time.Now().Add(20 * time.Second)

0 commit comments

Comments
 (0)