From acbe4477a3b3d80313d141f604f3b252801e9de0 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Wed, 14 Sep 2022 15:08:26 +0800 Subject: [PATCH 1/2] dns: support dns module in the snapshot For the initial iteration, only the default resolver can be serialized/deserialized. If `dns.setServers()` has been called, we'll preserve the configured DNS servers in the snapshot. We can consider exposing the serialization method if it becomes necessary for user-land snapshots. --- lib/internal/dns/utils.js | 69 ++++++++++++++++++- lib/internal/main/mksnapshot.js | 2 +- src/cares_wrap.cc | 36 +++++++++- src/cares_wrap.h | 3 +- src/node_external_reference.h | 1 + test/common/snapshot.js | 66 ++++++++++++++++++ test/fixtures/snapshot/dns-lookup.js | 39 +++++++++++ test/fixtures/snapshot/dns-resolve.js | 59 ++++++++++++++++ test/internet/test-snapshot-dns-lookup.js | 34 +++++++++ test/internet/test-snapshot-dns-resolve.js | 36 ++++++++++ ...t-snapshot-dns-lookup-localhost-promise.js | 35 ++++++++++ .../test-snapshot-dns-lookup-localhost.js | 35 ++++++++++ ...-snapshot-dns-resolve-localhost-promise.js | 34 +++++++++ .../test-snapshot-dns-resolve-localhost.js | 34 +++++++++ 14 files changed, 476 insertions(+), 7 deletions(-) create mode 100644 test/common/snapshot.js create mode 100644 test/fixtures/snapshot/dns-lookup.js create mode 100644 test/fixtures/snapshot/dns-resolve.js create mode 100644 test/internet/test-snapshot-dns-lookup.js create mode 100644 test/internet/test-snapshot-dns-resolve.js create mode 100644 test/parallel/test-snapshot-dns-lookup-localhost-promise.js create mode 100644 test/parallel/test-snapshot-dns-lookup-localhost.js create mode 100644 test/parallel/test-snapshot-dns-resolve-localhost-promise.js create mode 100644 test/parallel/test-snapshot-dns-resolve-localhost.js diff --git a/lib/internal/dns/utils.js b/lib/internal/dns/utils.js index f895a46c1a037e..6785ccaf59dcb2 100644 --- a/lib/internal/dns/utils.js +++ b/lib/internal/dns/utils.js @@ -10,6 +10,7 @@ const { RegExpPrototypeExec, RegExpPrototypeSymbolReplace, ObjectCreate, + Symbol, } = primordials; const errors = require('internal/errors'); @@ -35,6 +36,12 @@ const { ERR_INVALID_IP_ADDRESS, } = errors.codes; +const { + addSerializeCallback, + addDeserializeCallback, + isBuildingSnapshot +} = require('v8').startupSnapshot; + function validateTimeout(options) { const { timeout = -1 } = { ...options }; validateInt32(timeout, 'options.timeout', -1); @@ -47,12 +54,27 @@ function validateTries(options) { return tries; } +const kSerializeResolver = Symbol('dns:resolver:serialize'); +const kDeserializeResolver = Symbol('dns:resolver:deserialize'); +const kSnapshotStates = Symbol('dns:resolver:config'); +const kInitializeHandle = Symbol('dns:resolver:initializeHandle'); +const kSetServersInteral = Symbol('dns:resolver:setServers'); + // Resolver instances correspond 1:1 to c-ares channels. class ResolverBase { constructor(options = undefined) { const timeout = validateTimeout(options); const tries = validateTries(options); + // If we are building snapshot, save the states of the resolver along + // the way. + if (isBuildingSnapshot()) { + this[kSnapshotStates] = { timeout, tries }; + } + this[kInitializeHandle](timeout, tries); + } + + [kInitializeHandle](timeout, tries) { const { ChannelWrap } = lazyBinding(); this._handle = new ChannelWrap(timeout, tries); } @@ -77,9 +99,7 @@ class ResolverBase { // Cache the original servers because in the event of an error while // setting the servers, c-ares won't have any servers available for // resolution. - const orig = this._handle.getServers() || []; const newSet = []; - ArrayPrototypeForEach(servers, (serv, index) => { validateString(serv, `servers[${index}]`); let ipVersion = isIP(serv); @@ -118,6 +138,11 @@ class ResolverBase { throw new ERR_INVALID_IP_ADDRESS(serv); }); + this[kSetServersInteral](newSet, servers); + } + + [kSetServersInteral](newSet, servers) { + const orig = this._handle.getServers() || []; const errorNumber = this._handle.setServers(newSet); if (errorNumber !== 0) { @@ -127,8 +152,13 @@ class ResolverBase { const err = strerror(errorNumber); throw new ERR_DNS_SET_SERVERS_FAILED(err, servers); } + + if (isBuildingSnapshot()) { + this[kSnapshotStates].servers = newSet; + } } + setLocalAddress(ipv4, ipv6) { validateString(ipv4, 'ipv4'); @@ -137,6 +167,31 @@ class ResolverBase { } this._handle.setLocalAddress(ipv4, ipv6); + + if (isBuildingSnapshot()) { + this[kSnapshotStates].localAddress = { ipv4, ipv6 }; + } + } + + // TODO(joyeecheung): consider exposing this if custom DNS resolvers + // end up being useful for snapshot users. + [kSerializeResolver]() { + this._handle = null; // We'll restore it during deserialization. + addDeserializeCallback(function deserializeResolver(resolver) { + resolver[kDeserializeResolver](); + }, this); + } + + [kDeserializeResolver]() { + const { timeout, tries, localAddress, servers } = this[kSnapshotStates]; + this[kInitializeHandle](timeout, tries); + if (localAddress) { + const { ipv4, ipv6 } = localAddress; + this._handle.setLocalAddress(ipv4, ipv6); + } + if (servers) { + this[kSetServersInteral](servers, servers); + } } } @@ -151,6 +206,16 @@ function initializeDns() { // Allow the deserialized application to override order from CLI. dnsOrder = orderFromCLI; } + + if (!isBuildingSnapshot()) { + return; + } + + addSerializeCallback(() => { + if (defaultResolver !== undefined) { + defaultResolver[kSerializeResolver](); + } + }); } const resolverKeys = [ diff --git a/lib/internal/main/mksnapshot.js b/lib/internal/main/mksnapshot.js index 4add00e13c1fd2..d7ad9324114637 100644 --- a/lib/internal/main/mksnapshot.js +++ b/lib/internal/main/mksnapshot.js @@ -49,7 +49,7 @@ const supportedModules = new SafeSet(new SafeArrayIterator([ 'crypto', // 'dgram', 'diagnostics_channel', - // 'dns', + 'dns', // 'dns/promises', // 'domain', 'events', diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 1757d56d09ab4d..6f67539c13fa35 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -19,18 +19,19 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. +#include "cares_wrap.h" #include "async_wrap-inl.h" -#include "base_object-inl.h" #include "base64-inl.h" -#include "cares_wrap.h" +#include "base_object-inl.h" #include "env-inl.h" #include "memory_tracker-inl.h" #include "node.h" #include "node_errors.h" +#include "node_external_reference.h" #include "req_wrap-inl.h" #include "util-inl.h" -#include "v8.h" #include "uv.h" +#include "v8.h" #include #include @@ -1955,7 +1956,36 @@ void Initialize(Local target, SetConstructorFunction(context, target, "ChannelWrap", channel_wrap); } +void RegisterExternalReferences(ExternalReferenceRegistry* registry) { + registry->Register(GetAddrInfo); + registry->Register(GetNameInfo); + registry->Register(CanonicalizeIP); + registry->Register(StrError); + registry->Register(ChannelWrap::New); + + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + registry->Register(Query); + + registry->Register(GetServers); + registry->Register(SetServers); + registry->Register(SetLocalAddress); + registry->Register(Cancel); +} + } // namespace cares_wrap } // namespace node NODE_MODULE_CONTEXT_AWARE_INTERNAL(cares_wrap, node::cares_wrap::Initialize) +NODE_MODULE_EXTERNAL_REFERENCE(cares_wrap, + node::cares_wrap::RegisterExternalReferences) diff --git a/src/cares_wrap.h b/src/cares_wrap.h index 60f99e65edf348..ea339b773991e4 100644 --- a/src/cares_wrap.h +++ b/src/cares_wrap.h @@ -9,8 +9,9 @@ #include "base_object.h" #include "env.h" #include "memory_tracker.h" -#include "util.h" #include "node.h" +#include "node_internals.h" +#include "util.h" #include "ares.h" #include "v8.h" diff --git a/src/node_external_reference.h b/src/node_external_reference.h index a77c1ab14ee0de..9dc85d1b19adc2 100644 --- a/src/node_external_reference.h +++ b/src/node_external_reference.h @@ -62,6 +62,7 @@ class ExternalReferenceRegistry { V(blob) \ V(buffer) \ V(builtins) \ + V(cares_wrap) \ V(contextify) \ V(credentials) \ V(env_var) \ diff --git a/test/common/snapshot.js b/test/common/snapshot.js new file mode 100644 index 00000000000000..3f0f44f66ca00b --- /dev/null +++ b/test/common/snapshot.js @@ -0,0 +1,66 @@ +'use strict'; + +const tmpdir = require('../common/tmpdir'); +const { spawnSync } = require('child_process'); +const path = require('path'); +const fs = require('fs'); +const assert = require('assert'); + +function buildSnapshot(entry, env) { + const child = spawnSync(process.execPath, [ + '--snapshot-blob', + path.join(tmpdir.path, 'snapshot.blob'), + '--build-snapshot', + entry, + ], { + cwd: tmpdir.path, + env: { + ...process.env, + ...env + } + }); + + const stderr = child.stderr.toString(); + const stdout = child.stdout.toString(); + console.log('[stderr]'); + console.log(stderr); + console.log('[stdout]'); + console.log(stdout); + + assert.strictEqual(child.status, 0); + + const stats = fs.statSync(path.join(tmpdir.path, 'snapshot.blob')); + assert(stats.isFile()); + + return { child, stderr, stdout }; +} + +function runWithSnapshot(entry, env) { + const args = ['--snapshot-blob', path.join(tmpdir.path, 'snapshot.blob')]; + if (entry !== undefined) { + args.push(entry); + } + const child = spawnSync(process.execPath, args, { + cwd: tmpdir.path, + env: { + ...process.env, + ...env + } + }); + + const stderr = child.stderr.toString(); + const stdout = child.stdout.toString(); + console.log('[stderr]'); + console.log(stderr); + console.log('[stdout]'); + console.log(stdout); + + assert.strictEqual(child.status, 0); + + return { child, stderr, stdout }; +} + +module.exports = { + buildSnapshot, + runWithSnapshot +}; diff --git a/test/fixtures/snapshot/dns-lookup.js b/test/fixtures/snapshot/dns-lookup.js new file mode 100644 index 00000000000000..4d1480478ac857 --- /dev/null +++ b/test/fixtures/snapshot/dns-lookup.js @@ -0,0 +1,39 @@ +'use strict'; +const dns = require('dns'); +const assert = require('assert'); + +assert(process.env.NODE_TEST_HOST); + +const { + setDeserializeMainFunction +} = require('v8').startupSnapshot; + +function onError(err) { + console.error('error:', err); +} + +function onLookup(address, family) { + console.log(`address: ${JSON.stringify(address)}`); + console.log(`family: ${JSON.stringify(family)}`); +} + +function query() { + const host = process.env.NODE_TEST_HOST; + if (process.env.NODE_TEST_PROMISE === 'true') { + dns.promises.lookup(host, { family: 4 }).then( + ({address, family}) => onLookup(address, family), + onError); + } else { + dns.lookup(host, { family: 4 }, (err, address, family) => { + if (err) { + onError(err); + } else { + onLookup(address, family); + } + }); + } +} + +query(); + +setDeserializeMainFunction(query); diff --git a/test/fixtures/snapshot/dns-resolve.js b/test/fixtures/snapshot/dns-resolve.js new file mode 100644 index 00000000000000..c5f8ba8b80ee68 --- /dev/null +++ b/test/fixtures/snapshot/dns-resolve.js @@ -0,0 +1,59 @@ +'use strict'; +const dns = require('dns'); +const assert = require('assert'); + +assert(process.env.NODE_TEST_HOST); + +const { + setDeserializeMainFunction +} = require('v8').startupSnapshot; + +function onError(err) { + console.error('error:', err); +} + +function onResolve(addresses) { + console.log(`addresses: ${JSON.stringify(addresses)}`); +} + +function onReverse(hostnames) { + console.log(`hostnames: ${JSON.stringify(hostnames)}`); +} + +function query() { + if (process.env.NODE_TEST_DNS) { + dns.setServers([process.env.NODE_TEST_DNS]) + } + + const host = process.env.NODE_TEST_HOST; + if (process.env.NODE_TEST_PROMISE === 'true') { + dns.promises.resolve4(host).then(onResolve, onError); + } else { + dns.resolve4(host, (err, addresses) => { + if (err) { + onError(err); + } else { + onResolve(addresses); + } + }); + } + + const ip = process.env.NODE_TEST_IP; + if (ip) { + if (process.env.NODE_TEST_PROMISE === 'true') { + dns.promises.reverse(ip).then(onReverse, onError); + } else { + dns.reverse(ip, (err, hostnames) => { + if (err) { + onError(err); + } else { + onReverse(hostnames); + } + }); + } + } +} + +query(); + +setDeserializeMainFunction(query); diff --git a/test/internet/test-snapshot-dns-lookup.js b/test/internet/test-snapshot-dns-lookup.js new file mode 100644 index 00000000000000..ba1e202bd159a0 --- /dev/null +++ b/test/internet/test-snapshot-dns-lookup.js @@ -0,0 +1,34 @@ +'use strict'; + +// This tests support for the dns module in snapshot. + +require('../common'); +const assert = require('assert'); +const tmpdir = require('../common/tmpdir'); +const fixtures = require('../common/fixtures'); +const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); +const { + addresses: { INET4_HOST } +} = require('../common/internet'); + +const entry = fixtures.path('snapshot', 'dns-lookup.js'); +const env = { + NODE_TEST_HOST: INET4_HOST, + NODE_TEST_PROMISE: 'false' +}; + +tmpdir.refresh(); +function checkOutput(stderr, stdout) { + assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/)); + assert(stdout.match(stdout, /family: 4/)); + assert.strictEqual(stdout.trim().split('\n').length, 2); +} +{ + const { stderr, stdout } = buildSnapshot(entry, env); + checkOutput(stderr, stdout); +} + +{ + const { stderr, stdout } = runWithSnapshot(entry, env); + checkOutput(stderr, stdout); +} diff --git a/test/internet/test-snapshot-dns-resolve.js b/test/internet/test-snapshot-dns-resolve.js new file mode 100644 index 00000000000000..c4f5674f0afa39 --- /dev/null +++ b/test/internet/test-snapshot-dns-resolve.js @@ -0,0 +1,36 @@ +'use strict'; + +// This tests support for the dns module in snapshot. + +require('../common'); +const assert = require('assert'); +const tmpdir = require('../common/tmpdir'); +const fixtures = require('../common/fixtures'); +const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); +const { + addresses: { DNS4_SERVER, INET4_IP, INET4_HOST } +} = require('../common/internet'); + +const entry = fixtures.path('snapshot', 'dns-resolve.js'); +const env = { + NODE_TEST_IP: INET4_IP, + NODE_TEST_HOST: INET4_HOST, + NODE_TEST_DNS: DNS4_SERVER, + NODE_TEST_PROMISE: 'false' +}; + +tmpdir.refresh(); +function checkOutput(stderr, stdout) { + assert(stdout.includes('hostnames: [')); + assert(stdout.includes('addresses: [')); + assert.strictEqual(stdout.trim().split('\n').length, 2); +} +{ + const { stderr, stdout } = buildSnapshot(entry, env); + checkOutput(stderr, stdout); +} + +{ + const { stderr, stdout } = runWithSnapshot(entry, env); + checkOutput(stderr, stdout); +} diff --git a/test/parallel/test-snapshot-dns-lookup-localhost-promise.js b/test/parallel/test-snapshot-dns-lookup-localhost-promise.js new file mode 100644 index 00000000000000..2cdf051c8df2c7 --- /dev/null +++ b/test/parallel/test-snapshot-dns-lookup-localhost-promise.js @@ -0,0 +1,35 @@ +'use strict'; + +// This tests support for the dns module in snapshot. + +require('../common'); +const assert = require('assert'); +const tmpdir = require('../common/tmpdir'); +const fixtures = require('../common/fixtures'); +const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); + +const entry = fixtures.path('snapshot', 'dns-lookup.js'); +const env = { + NODE_TEST_HOST: 'localhost', + NODE_TEST_PROMISE: 'true' +}; + +tmpdir.refresh(); +function checkOutput(stderr, stdout) { + // We allow failures as it's not always possible to resolve localhost. + // Functional tests are done in test/internet instead. + if (!stderr.startsWith('error:')) { + assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/)); + assert(stdout.match(stdout, /family: 4/)); + assert.strictEqual(stdout.trim().split('\n').length, 2); + } +} +{ + const { stderr, stdout } = buildSnapshot(entry, env); + checkOutput(stderr, stdout); +} + +{ + const { stderr, stdout } = runWithSnapshot(entry, env); + checkOutput(stderr, stdout); +} diff --git a/test/parallel/test-snapshot-dns-lookup-localhost.js b/test/parallel/test-snapshot-dns-lookup-localhost.js new file mode 100644 index 00000000000000..ec985c1783a6fa --- /dev/null +++ b/test/parallel/test-snapshot-dns-lookup-localhost.js @@ -0,0 +1,35 @@ +'use strict'; + +// This tests support for the dns module in snapshot. + +require('../common'); +const assert = require('assert'); +const tmpdir = require('../common/tmpdir'); +const fixtures = require('../common/fixtures'); +const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); + +const entry = fixtures.path('snapshot', 'dns-lookup.js'); +const env = { + NODE_TEST_HOST: 'localhost', + NODE_TEST_PROMISE: 'false' +}; + +tmpdir.refresh(); +function checkOutput(stderr, stdout) { + // We allow failures as it's not always possible to resolve localhost. + // Functional tests are done in test/internet instead. + if (!stderr.startsWith('error:')) { + assert(stdout.match(stdout, /address: "\d+\.\d+\.\d+\.\d+"/)); + assert(stdout.match(stdout, /family: 4/)); + assert.strictEqual(stdout.trim().split('\n').length, 2); + } +} +{ + const { stderr, stdout } = buildSnapshot(entry, env); + checkOutput(stderr, stdout); +} + +{ + const { stderr, stdout } = runWithSnapshot(entry, env); + checkOutput(stderr, stdout); +} diff --git a/test/parallel/test-snapshot-dns-resolve-localhost-promise.js b/test/parallel/test-snapshot-dns-resolve-localhost-promise.js new file mode 100644 index 00000000000000..0e551948a33b33 --- /dev/null +++ b/test/parallel/test-snapshot-dns-resolve-localhost-promise.js @@ -0,0 +1,34 @@ +'use strict'; + +// This tests support for the dns module in snapshot. + +require('../common'); +const assert = require('assert'); +const tmpdir = require('../common/tmpdir'); +const fixtures = require('../common/fixtures'); +const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); + +const entry = fixtures.path('snapshot', 'dns-resolve.js'); +const env = { + NODE_TEST_HOST: 'localhost', + NODE_TEST_PROMISE: 'true' +}; + +tmpdir.refresh(); +function checkOutput(stderr, stdout) { + // We allow failures as it's not always possible to resolve localhost. + // Functional tests are done in test/internet instead. + if (!stderr.startsWith('error:')) { + assert(stdout.includes('addresses: [')); + assert.strictEqual(stdout.trim().split('\n').length, 1); + } +} +{ + const { stderr, stdout } = buildSnapshot(entry, env); + checkOutput(stderr, stdout); +} + +{ + const { stderr, stdout } = runWithSnapshot(entry, env); + checkOutput(stderr, stdout); +} diff --git a/test/parallel/test-snapshot-dns-resolve-localhost.js b/test/parallel/test-snapshot-dns-resolve-localhost.js new file mode 100644 index 00000000000000..0a4c1c67509cd1 --- /dev/null +++ b/test/parallel/test-snapshot-dns-resolve-localhost.js @@ -0,0 +1,34 @@ +'use strict'; + +// This tests support for the dns module in snapshot. + +require('../common'); +const assert = require('assert'); +const tmpdir = require('../common/tmpdir'); +const fixtures = require('../common/fixtures'); +const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); + +const entry = fixtures.path('snapshot', 'dns-resolve.js'); +const env = { + NODE_TEST_HOST: 'localhost', + NODE_TEST_PROMISE: 'false' +}; + +tmpdir.refresh(); +function checkOutput(stderr, stdout) { + // We allow failures as it's not always possible to resolve localhost. + // Functional tests are done in test/internet instead. + if (!stderr.startsWith('error:')) { + assert(stdout.includes('addresses: [')); + assert.strictEqual(stdout.trim().split('\n').length, 1); + } +} +{ + const { stderr, stdout } = buildSnapshot(entry, env); + checkOutput(stderr, stdout); +} + +{ + const { stderr, stdout } = runWithSnapshot(entry, env); + checkOutput(stderr, stdout); +} From 57e75070940cf4a7eb10782afa5ab871bf8ad805 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Tue, 20 Sep 2022 19:38:36 +0800 Subject: [PATCH 2/2] fixup! dns: support dns module in the snapshot Co-authored-by: Antoine du Hamel --- lib/internal/dns/utils.js | 6 ++---- test/common/snapshot.js | 8 ++++---- test/fixtures/snapshot/dns-lookup.js | 2 +- test/fixtures/snapshot/dns-resolve.js | 2 +- test/internet/test-snapshot-dns-lookup.js | 4 ++-- test/internet/test-snapshot-dns-resolve.js | 4 ++-- .../test-snapshot-dns-lookup-localhost-promise.js | 2 +- test/parallel/test-snapshot-dns-lookup-localhost.js | 2 +- .../test-snapshot-dns-resolve-localhost-promise.js | 2 +- test/parallel/test-snapshot-dns-resolve-localhost.js | 2 +- 10 files changed, 16 insertions(+), 18 deletions(-) diff --git a/lib/internal/dns/utils.js b/lib/internal/dns/utils.js index 6785ccaf59dcb2..511d857b59191c 100644 --- a/lib/internal/dns/utils.js +++ b/lib/internal/dns/utils.js @@ -39,7 +39,7 @@ const { const { addSerializeCallback, addDeserializeCallback, - isBuildingSnapshot + isBuildingSnapshot, } = require('v8').startupSnapshot; function validateTimeout(options) { @@ -212,9 +212,7 @@ function initializeDns() { } addSerializeCallback(() => { - if (defaultResolver !== undefined) { - defaultResolver[kSerializeResolver](); - } + defaultResolver?.[kSerializeResolver](); }); } diff --git a/test/common/snapshot.js b/test/common/snapshot.js index 3f0f44f66ca00b..97367c05656c3c 100644 --- a/test/common/snapshot.js +++ b/test/common/snapshot.js @@ -16,8 +16,8 @@ function buildSnapshot(entry, env) { cwd: tmpdir.path, env: { ...process.env, - ...env - } + ...env, + }, }); const stderr = child.stderr.toString(); @@ -44,7 +44,7 @@ function runWithSnapshot(entry, env) { cwd: tmpdir.path, env: { ...process.env, - ...env + ...env, } }); @@ -62,5 +62,5 @@ function runWithSnapshot(entry, env) { module.exports = { buildSnapshot, - runWithSnapshot + runWithSnapshot, }; diff --git a/test/fixtures/snapshot/dns-lookup.js b/test/fixtures/snapshot/dns-lookup.js index 4d1480478ac857..773b508f7cb214 100644 --- a/test/fixtures/snapshot/dns-lookup.js +++ b/test/fixtures/snapshot/dns-lookup.js @@ -5,7 +5,7 @@ const assert = require('assert'); assert(process.env.NODE_TEST_HOST); const { - setDeserializeMainFunction + setDeserializeMainFunction, } = require('v8').startupSnapshot; function onError(err) { diff --git a/test/fixtures/snapshot/dns-resolve.js b/test/fixtures/snapshot/dns-resolve.js index c5f8ba8b80ee68..6a776f29704cf5 100644 --- a/test/fixtures/snapshot/dns-resolve.js +++ b/test/fixtures/snapshot/dns-resolve.js @@ -5,7 +5,7 @@ const assert = require('assert'); assert(process.env.NODE_TEST_HOST); const { - setDeserializeMainFunction + setDeserializeMainFunction, } = require('v8').startupSnapshot; function onError(err) { diff --git a/test/internet/test-snapshot-dns-lookup.js b/test/internet/test-snapshot-dns-lookup.js index ba1e202bd159a0..842e73e0568839 100644 --- a/test/internet/test-snapshot-dns-lookup.js +++ b/test/internet/test-snapshot-dns-lookup.js @@ -8,13 +8,13 @@ const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); const { - addresses: { INET4_HOST } + addresses: { INET4_HOST }, } = require('../common/internet'); const entry = fixtures.path('snapshot', 'dns-lookup.js'); const env = { NODE_TEST_HOST: INET4_HOST, - NODE_TEST_PROMISE: 'false' + NODE_TEST_PROMISE: 'false', }; tmpdir.refresh(); diff --git a/test/internet/test-snapshot-dns-resolve.js b/test/internet/test-snapshot-dns-resolve.js index c4f5674f0afa39..6efea9b4f741a0 100644 --- a/test/internet/test-snapshot-dns-resolve.js +++ b/test/internet/test-snapshot-dns-resolve.js @@ -8,7 +8,7 @@ const tmpdir = require('../common/tmpdir'); const fixtures = require('../common/fixtures'); const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); const { - addresses: { DNS4_SERVER, INET4_IP, INET4_HOST } + addresses: { DNS4_SERVER, INET4_IP, INET4_HOST }, } = require('../common/internet'); const entry = fixtures.path('snapshot', 'dns-resolve.js'); @@ -16,7 +16,7 @@ const env = { NODE_TEST_IP: INET4_IP, NODE_TEST_HOST: INET4_HOST, NODE_TEST_DNS: DNS4_SERVER, - NODE_TEST_PROMISE: 'false' + NODE_TEST_PROMISE: 'false', }; tmpdir.refresh(); diff --git a/test/parallel/test-snapshot-dns-lookup-localhost-promise.js b/test/parallel/test-snapshot-dns-lookup-localhost-promise.js index 2cdf051c8df2c7..d19488a716aa04 100644 --- a/test/parallel/test-snapshot-dns-lookup-localhost-promise.js +++ b/test/parallel/test-snapshot-dns-lookup-localhost-promise.js @@ -11,7 +11,7 @@ const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); const entry = fixtures.path('snapshot', 'dns-lookup.js'); const env = { NODE_TEST_HOST: 'localhost', - NODE_TEST_PROMISE: 'true' + NODE_TEST_PROMISE: 'true', }; tmpdir.refresh(); diff --git a/test/parallel/test-snapshot-dns-lookup-localhost.js b/test/parallel/test-snapshot-dns-lookup-localhost.js index ec985c1783a6fa..af00480bcca89b 100644 --- a/test/parallel/test-snapshot-dns-lookup-localhost.js +++ b/test/parallel/test-snapshot-dns-lookup-localhost.js @@ -11,7 +11,7 @@ const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); const entry = fixtures.path('snapshot', 'dns-lookup.js'); const env = { NODE_TEST_HOST: 'localhost', - NODE_TEST_PROMISE: 'false' + NODE_TEST_PROMISE: 'false', }; tmpdir.refresh(); diff --git a/test/parallel/test-snapshot-dns-resolve-localhost-promise.js b/test/parallel/test-snapshot-dns-resolve-localhost-promise.js index 0e551948a33b33..cca86007f16f67 100644 --- a/test/parallel/test-snapshot-dns-resolve-localhost-promise.js +++ b/test/parallel/test-snapshot-dns-resolve-localhost-promise.js @@ -11,7 +11,7 @@ const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); const entry = fixtures.path('snapshot', 'dns-resolve.js'); const env = { NODE_TEST_HOST: 'localhost', - NODE_TEST_PROMISE: 'true' + NODE_TEST_PROMISE: 'true', }; tmpdir.refresh(); diff --git a/test/parallel/test-snapshot-dns-resolve-localhost.js b/test/parallel/test-snapshot-dns-resolve-localhost.js index 0a4c1c67509cd1..af4576bcc3e48a 100644 --- a/test/parallel/test-snapshot-dns-resolve-localhost.js +++ b/test/parallel/test-snapshot-dns-resolve-localhost.js @@ -11,7 +11,7 @@ const { buildSnapshot, runWithSnapshot } = require('../common/snapshot'); const entry = fixtures.path('snapshot', 'dns-resolve.js'); const env = { NODE_TEST_HOST: 'localhost', - NODE_TEST_PROMISE: 'false' + NODE_TEST_PROMISE: 'false', }; tmpdir.refresh();