diff options
Diffstat (limited to 'cli/tests/unit/net_test.ts')
-rw-r--r-- | cli/tests/unit/net_test.ts | 73 |
1 files changed, 47 insertions, 26 deletions
diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index 597bc4be1..180f8d88e 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -17,7 +17,7 @@ try { isCI = true; } -unitTest({ perms: { net: true } }, function netTcpListenClose() { +unitTest({ permissions: { net: true } }, function netTcpListenClose() { const listener = Deno.listen({ hostname: "127.0.0.1", port: 3500 }); assert(listener.addr.transport === "tcp"); assertEquals(listener.addr.hostname, "127.0.0.1"); @@ -28,7 +28,7 @@ unitTest({ perms: { net: true } }, function netTcpListenClose() { unitTest( { - perms: { net: true }, + permissions: { net: true }, }, function netUdpListenClose() { const socket = Deno.listenDatagram({ @@ -44,7 +44,10 @@ unitTest( ); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, + { + ignore: Deno.build.os === "windows", + permissions: { read: true, write: true }, + }, function netUnixListenClose() { const filePath = Deno.makeTempFileSync(); const socket = Deno.listen({ @@ -58,7 +61,10 @@ unitTest( ); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, + { + ignore: Deno.build.os === "windows", + permissions: { read: true, write: true }, + }, function netUnixPacketListenClose() { const filePath = Deno.makeTempFileSync(); const socket = Deno.listenDatagram({ @@ -72,7 +78,7 @@ unitTest( ); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true } }, + { ignore: Deno.build.os === "windows", permissions: { read: true } }, function netUnixListenWritePermission() { assertThrows(() => { const filePath = Deno.makeTempFileSync(); @@ -88,7 +94,7 @@ unitTest( ); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true } }, + { ignore: Deno.build.os === "windows", permissions: { read: true } }, function netUnixPacketListenWritePermission() { assertThrows(() => { const filePath = Deno.makeTempFileSync(); @@ -105,7 +111,7 @@ unitTest( unitTest( { - perms: { net: true }, + permissions: { net: true }, }, async function netTcpCloseWhileAccept() { const listener = Deno.listen({ port: 4501 }); @@ -122,7 +128,10 @@ unitTest( ); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, + { + ignore: Deno.build.os === "windows", + permissions: { read: true, write: true }, + }, async function netUnixCloseWhileAccept() { const filePath = await Deno.makeTempFile(); const listener = Deno.listen({ @@ -142,7 +151,7 @@ unitTest( ); unitTest( - { perms: { net: true } }, + { permissions: { net: true } }, async function netTcpConcurrentAccept() { const listener = Deno.listen({ port: 4502 }); let acceptErrCount = 0; @@ -166,7 +175,7 @@ unitTest( // TODO(jsouto): Enable when tokio updates mio to v0.7! unitTest( - { ignore: true, perms: { read: true, write: true } }, + { ignore: true, permissions: { read: true, write: true } }, async function netUnixConcurrentAccept() { const filePath = await Deno.makeTempFile(); const listener = Deno.listen({ transport: "unix", path: filePath }); @@ -189,7 +198,7 @@ unitTest( }, ); -unitTest({ perms: { net: true } }, async function netTcpDialListen() { +unitTest({ permissions: { net: true } }, async function netTcpDialListen() { const listener = Deno.listen({ port: 3500 }); listener.accept().then( async (conn) => { @@ -225,7 +234,10 @@ unitTest({ perms: { net: true } }, async function netTcpDialListen() { }); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, + { + ignore: Deno.build.os === "windows", + permissions: { read: true, write: true }, + }, async function netUnixDialListen() { const filePath = await Deno.makeTempFile(); const listener = Deno.listen({ path: filePath, transport: "unix" }); @@ -261,7 +273,7 @@ unitTest( ); unitTest( - { perms: { net: true } }, + { permissions: { net: true } }, async function netUdpSendReceive() { const alice = Deno.listenDatagram({ port: 3500, transport: "udp" }); assert(alice.addr.transport === "udp"); @@ -291,7 +303,7 @@ unitTest( ); unitTest( - { perms: { net: true } }, + { permissions: { net: true } }, async function netUdpConcurrentSendReceive() { const socket = Deno.listenDatagram({ port: 3500, transport: "udp" }); assert(socket.addr.transport === "udp"); @@ -315,7 +327,7 @@ unitTest( ); unitTest( - { perms: { net: true } }, + { permissions: { net: true } }, async function netUdpBorrowMutError() { const socket = Deno.listenDatagram({ port: 4501, @@ -330,7 +342,10 @@ unitTest( ); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, + { + ignore: Deno.build.os === "windows", + permissions: { read: true, write: true }, + }, async function netUnixPacketSendReceive() { const filePath = await Deno.makeTempFile(); const alice = Deno.listenDatagram({ @@ -365,7 +380,7 @@ unitTest( // TODO(piscisaureus): Enable after Tokio v0.3/v1.0 upgrade. unitTest( - { ignore: true, perms: { read: true, write: true } }, + { ignore: true, permissions: { read: true, write: true } }, async function netUnixPacketConcurrentSendReceive() { const filePath = await Deno.makeTempFile(); const socket = Deno.listenDatagram({ @@ -392,7 +407,7 @@ unitTest( ); unitTest( - { perms: { net: true } }, + { permissions: { net: true } }, async function netTcpListenIteratorBreakClosesResource() { async function iterate(listener: Deno.Listener) { let i = 0; @@ -422,7 +437,7 @@ unitTest( ); unitTest( - { perms: { net: true } }, + { permissions: { net: true } }, async function netTcpListenCloseWhileIterating() { const listener = Deno.listen({ port: 8001 }); const nextWhileClosing = listener[Symbol.asyncIterator]().next(); @@ -435,7 +450,7 @@ unitTest( ); unitTest( - { perms: { net: true } }, + { permissions: { net: true } }, async function netUdpListenCloseWhileIterating() { const socket = Deno.listenDatagram({ port: 8000, transport: "udp" }); const nextWhileClosing = socket[Symbol.asyncIterator]().next(); @@ -448,7 +463,10 @@ unitTest( ); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, + { + ignore: Deno.build.os === "windows", + permissions: { read: true, write: true }, + }, async function netUnixListenCloseWhileIterating() { const filePath = Deno.makeTempFileSync(); const socket = Deno.listen({ path: filePath, transport: "unix" }); @@ -462,7 +480,10 @@ unitTest( ); unitTest( - { ignore: Deno.build.os === "windows", perms: { read: true, write: true } }, + { + ignore: Deno.build.os === "windows", + permissions: { read: true, write: true }, + }, async function netUnixPacketListenCloseWhileIterating() { const filePath = Deno.makeTempFileSync(); const socket = Deno.listenDatagram({ @@ -482,7 +503,7 @@ unitTest( { // FIXME(bartlomieju) ignore: true, - perms: { net: true }, + permissions: { net: true }, }, async function netListenAsyncIterator() { const addr = { hostname: "127.0.0.1", port: 3500 }; @@ -515,7 +536,7 @@ unitTest( unitTest( { - perms: { net: true }, + permissions: { net: true }, }, async function netCloseWriteSuccess() { const addr = { hostname: "127.0.0.1", port: 3500 }; @@ -550,7 +571,7 @@ unitTest( { // https://github.com/denoland/deno/issues/11580 ignore: Deno.build.os === "darwin" && isCI, - perms: { net: true }, + permissions: { net: true }, }, async function netHangsOnClose() { let acceptedConn: Deno.Conn; @@ -596,7 +617,7 @@ unitTest( unitTest( { - perms: { net: true }, + permissions: { net: true }, }, function netExplicitUndefinedHostname() { const listener = Deno.listen({ hostname: undefined, port: 8080 }); |