mirror of
https://github.com/zotero/zotero.git
synced 2026-08-28 05:25:31 +00:00
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:
parent
ad1bec62f2
commit
4e532a17a2
2 changed files with 24 additions and 2 deletions
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue