mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
test(cli): fix brittle network permission test (#8526)
This commit is contained in:
parent
e2858d0bbb
commit
a16adca06b
1 changed files with 4 additions and 10 deletions
|
@ -68,7 +68,7 @@ unitTest(
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true } },
|
{ ignore: Deno.build.os === "windows", perms: { read: true } },
|
||||||
function netUnixListenWritePermission(): void {
|
function netUnixListenWritePermission(): void {
|
||||||
try {
|
assertThrows(() => {
|
||||||
const filePath = Deno.makeTempFileSync();
|
const filePath = Deno.makeTempFileSync();
|
||||||
const socket = Deno.listen({
|
const socket = Deno.listen({
|
||||||
path: filePath,
|
path: filePath,
|
||||||
|
@ -77,17 +77,14 @@ unitTest(
|
||||||
assert(socket.addr.transport === "unix");
|
assert(socket.addr.transport === "unix");
|
||||||
assertEquals(socket.addr.path, filePath);
|
assertEquals(socket.addr.path, filePath);
|
||||||
socket.close();
|
socket.close();
|
||||||
} catch (e) {
|
}, Deno.errors.PermissionDenied);
|
||||||
assert(!!e);
|
|
||||||
assert(e instanceof Deno.errors.PermissionDenied);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
unitTest(
|
unitTest(
|
||||||
{ ignore: Deno.build.os === "windows", perms: { read: true } },
|
{ ignore: Deno.build.os === "windows", perms: { read: true } },
|
||||||
function netUnixPacketListenWritePermission(): void {
|
function netUnixPacketListenWritePermission(): void {
|
||||||
try {
|
assertThrows(() => {
|
||||||
const filePath = Deno.makeTempFileSync();
|
const filePath = Deno.makeTempFileSync();
|
||||||
const socket = Deno.listenDatagram({
|
const socket = Deno.listenDatagram({
|
||||||
path: filePath,
|
path: filePath,
|
||||||
|
@ -96,10 +93,7 @@ unitTest(
|
||||||
assert(socket.addr.transport === "unixpacket");
|
assert(socket.addr.transport === "unixpacket");
|
||||||
assertEquals(socket.addr.path, filePath);
|
assertEquals(socket.addr.path, filePath);
|
||||||
socket.close();
|
socket.close();
|
||||||
} catch (e) {
|
}, Deno.errors.PermissionDenied);
|
||||||
assert(!!e);
|
|
||||||
assert(e instanceof Deno.errors.PermissionDenied);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue