Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): fix brittle network permission test #8526

Merged
merged 1 commit into from
Nov 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore(tests): fix brittle network permission test
Fixes a brittle test that was identified in #8511 after it was merged.
  • Loading branch information
wperron committed Nov 27, 2020
commit bfe42a92c56caedd476c4f01db7acabb43e0cc11
14 changes: 4 additions & 10 deletions cli/tests/unit/net_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ unitTest(
unitTest(
{ ignore: Deno.build.os === "windows", perms: { read: true } },
function netUnixListenWritePermission(): void {
try {
assertThrows(() => {
const filePath = Deno.makeTempFileSync();
const socket = Deno.listen({
path: filePath,
Expand All @@ -77,17 +77,14 @@ unitTest(
assert(socket.addr.transport === "unix");
assertEquals(socket.addr.path, filePath);
socket.close();
} catch (e) {
assert(!!e);
assert(e instanceof Deno.errors.PermissionDenied);
}
}, Deno.errors.PermissionDenied);
},
);

unitTest(
{ ignore: Deno.build.os === "windows", perms: { read: true } },
function netUnixPacketListenWritePermission(): void {
try {
assertThrows(() => {
const filePath = Deno.makeTempFileSync();
const socket = Deno.listenDatagram({
path: filePath,
Expand All @@ -96,10 +93,7 @@ unitTest(
assert(socket.addr.transport === "unixpacket");
assertEquals(socket.addr.path, filePath);
socket.close();
} catch (e) {
assert(!!e);
assert(e instanceof Deno.errors.PermissionDenied);
}
}, Deno.errors.PermissionDenied);
},
);

Expand Down