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

test: fix test-dgram-udp6-link-local-address on Windows #40005

Closed
wants to merge 1 commit into from
Closed
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
6 changes: 4 additions & 2 deletions test/parallel/test-dgram-udp6-link-local-address.js
Original file line number Diff line number Diff line change
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