mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-23 00:05:27 +00:00
test: assert artifact read flags outside verifier error handling
This commit is contained in:
1 file changed
+6
-3
@@ -237,9 +237,10 @@ async function run() {
|
||||
const canonicalArtifact = path.join(fs.realpathSync(root), 'matrix.md');
|
||||
const open = fs.openSync;
|
||||
const readFlags = fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0) | (fs.constants.O_NONBLOCK || 0);
|
||||
let observedArtifactFlags;
|
||||
fs.openSync = function (filename, flags, mode) {
|
||||
if (filename === canonicalArtifact) {
|
||||
assert.strictEqual(flags, readFlags, 'artifact reads must retain nonblocking/no-follow flags');
|
||||
observedArtifactFlags = flags;
|
||||
fs.unlinkSync(artifact); makeFifo();
|
||||
return open(filename, fs.constants.O_RDONLY | (fs.constants.O_NOFOLLOW || 0) | (fs.constants.O_NONBLOCK || 0));
|
||||
}
|
||||
@@ -254,8 +255,10 @@ async function run() {
|
||||
assert.strictEqual(flags, 'r', 'unexpected file-open mode during verification');
|
||||
return open(filename, 'r');
|
||||
};
|
||||
try { assert.strictEqual(store.verifyWorkItem('docs-task').attempt.outcome, 'unknown'); }
|
||||
finally { fs.openSync = open; }
|
||||
try {
|
||||
assert.strictEqual(store.verifyWorkItem('docs-task').attempt.outcome, 'unknown');
|
||||
assert.strictEqual(observedArtifactFlags, readFlags, 'artifact reads must retain nonblocking/no-follow flags');
|
||||
} finally { fs.openSync = open; }
|
||||
});
|
||||
|
||||
await test('the validator comes from ECC, never a module supplied by the artifact repository', ({ root, store, register, claim, artifact }) => {
|
||||
|
||||
Reference in new issue
Block a user