Skip symlink tests on filesystems without symlink support

CIFS mounts can't create real symlinks without special mount options,
so skip the symlinked-database and broken-symlink tests when a created
symlink doesn't exist or isn't visible as one.
This commit is contained in:
Dan Stillman 2026-08-18 22:39:46 -04:00
parent ad1bec62f2
commit 4e532a17a2
2 changed files with 24 additions and 2 deletions

View file

@ -1240,6 +1240,10 @@ describe("Zotero.DB", function () {
await IOUtils.move(targetPath + '.copy', targetPath);
await IOUtils.move(targetPath + '.copy-wal', targetPath + '-wal');
await Zotero.Utilities.Internal.subprocess('/bin/ln', ['-s', targetPath, linkPath]);
if (!(await IOUtils.exists(linkPath))) {
// Filesystem doesn't support symlinks (e.g., CIFS)
this.skip();
}
let db2 = new Zotero.DBConnection(linkPath);
assert.isTrue(await db2._downgradeDatabaseFromWAL(linkPath));

View file

@ -326,7 +326,16 @@ describe("Zotero.File", function () {
var tmpPath = await getTempDirectory();
var destPath = OS.Path.join(tmpPath, 'missing');
var linkPath = OS.Path.join(tmpPath, 'link');
await OS.File.unixSymLink(destPath, linkPath);
var isSymlink = false;
try {
await OS.File.unixSymLink(destPath, linkPath);
isSymlink = Zotero.File.pathToFile(linkPath).isSymlink();
}
catch (e) {}
if (!isSymlink) {
// Symlink couldn't be created or isn't visible as one (e.g., on CIFS)
this.skip();
}
assert.throws(() => Zotero.File.createDirectoryIfMissing(linkPath), /^Broken symlink/);
});
@ -341,7 +350,16 @@ describe("Zotero.File", function () {
var tmpPath = await getTempDirectory();
var destPath = OS.Path.join(tmpPath, 'missing');
var linkPath = OS.Path.join(tmpPath, 'link');
await OS.File.unixSymLink(destPath, linkPath);
var isSymlink = false;
try {
await OS.File.unixSymLink(destPath, linkPath);
isSymlink = Zotero.File.pathToFile(linkPath).isSymlink();
}
catch (e) {}
if (!isSymlink) {
// Symlink couldn't be created or isn't visible as one (e.g., on CIFS)
this.skip();
}
var e = await getPromiseError(Zotero.File.createDirectoryIfMissingAsync(linkPath));
assert.ok(e);