test: skip tests failing when run under root
PR-URL: https://github.com/nodejs/node/pull/58610 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com> Reviewed-By: Edy Silva <edigleyssonsilva@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
This commit is contained in:
parent
58e1cba200
commit
be2120f1cd
@ -361,7 +361,10 @@ test('should override node.config.json when specificied', async () => {
|
||||
strictEqual(result.code, 0);
|
||||
});
|
||||
// Skip on windows because it doesn't support chmod changing read permissions
|
||||
test('should throw an error when the file is non readable', { skip: common.isWindows }, async () => {
|
||||
// Also skip if user is root because it would have read permissions anyway
|
||||
test('should throw an error when the file is non readable', {
|
||||
skip: common.isWindows || process.getuid() === 0,
|
||||
}, async () => {
|
||||
chmodSync(fixtures.path('rc/non-readable/node.config.json'), constants.O_RDONLY);
|
||||
const result = await spawnPromisified(process.execPath, [
|
||||
'--no-warnings',
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { skipIfSQLiteMissing } from '../common/index.mjs';
|
||||
import { isWindows, skipIfSQLiteMissing } from '../common/index.mjs';
|
||||
import tmpdir from '../common/tmpdir.js';
|
||||
import { join } from 'node:path';
|
||||
import { describe, test } from 'node:test';
|
||||
@ -7,6 +7,8 @@ import { pathToFileURL } from 'node:url';
|
||||
skipIfSQLiteMissing();
|
||||
const { backup, DatabaseSync } = await import('node:sqlite');
|
||||
|
||||
const isRoot = !isWindows && process.getuid() === 0;
|
||||
|
||||
let cnt = 0;
|
||||
|
||||
tmpdir.refresh();
|
||||
@ -252,7 +254,7 @@ test('throws if URL is not file: scheme', (t) => {
|
||||
});
|
||||
});
|
||||
|
||||
test('database backup fails when dest file is not writable', async (t) => {
|
||||
test('database backup fails when dest file is not writable', { skip: isRoot }, async (t) => {
|
||||
const readonlyDestDb = nextDb();
|
||||
writeFileSync(readonlyDestDb, '', { mode: 0o444 });
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user