fstest: shut down test remotes when finished with them

Remotes made by RandomRemote aren't in the fs cache so they were never
shut down, leaving any pooled connections open until they timed out.

On TestFTPProftpd this used up the server's 30 connection limit part way
through the fs/operations tests, making all the following tests fail
with EOF when connecting.
This commit is contained in:
Nick Craig-Wood committed 2026-10-28 15:04:56 +00:00
1 parent 8594059b6a
commit 4db2817932
1 file changed
+8
+8
View File
@@ -476,6 +476,14 @@ func RandomRemote() (fs.Fs, string, func(), error) {
fs.Logf(nil, "Failed to purge %v: %v", parentRemote, err)
}
}
// The remote isn't in the fs cache so release its resources
// (e.g. pooled connections) here rather than letting them
// pile up until they time out.
if do := remote.Features().Shutdown; do != nil {
if err := do(context.Background()); err != nil {
fs.Logf(nil, "Failed to shutdown %v: %v", remote, err)
}
}
}
return remote, remoteName, finalise, nil