Skip to content

Commit

Permalink
test: fix test-dgram-udp6-link-local-address on Windows
Browse files Browse the repository at this point in the history
PR-URL: #40005
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
targos authored and BethGriggs committed Sep 21, 2021
1 parent b6939a3 commit 6be405b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/parallel/test-dgram-udp6-link-local-address.js
Expand Up @@ -7,6 +7,8 @@ const assert = require('assert');
const dgram = require('dgram');
const os = require('os');

const { isWindows } = common;

function linklocal() {
for (const [ifname, entries] of Object.entries(os.networkInterfaces())) {
for (const { address, family, scopeid } of entries) {
Expand All @@ -21,7 +23,7 @@ const iface = linklocal();
if (!iface)
common.skip('cannot find any IPv6 interfaces with a link local address');

const address = `${iface.address}%${iface.ifname}`;
const address = isWindows ? iface.address : `${iface.address}%${iface.ifname}`;
const message = 'Hello, local world!';

// Create a client socket for sending to the link-local address.
Expand All @@ -42,7 +44,7 @@ server.on('message', common.mustCall((buf, info) => {
// including the link local scope identifier.
assert.strictEqual(
info.address,
common.isWindows ? `${iface.address}%${iface.scopeid}` : address
isWindows ? `${iface.address}%${iface.scopeid}` : address
);
server.close();
client.close();
Expand Down

0 comments on commit 6be405b

Please sign in to comment.