2015-05-19 11:00:06 +00:00
|
|
|
'use strict';
|
2017-10-22 18:07:54 +00:00
|
|
|
const common = require('../common');
|
|
|
|
const { addresses } = require('../common/internet');
|
2016-12-30 23:38:06 +00:00
|
|
|
const assert = require('assert');
|
|
|
|
const dns = require('dns');
|
|
|
|
const domain = require('domain');
|
2014-11-16 02:33:20 +00:00
|
|
|
|
2017-01-08 13:19:00 +00:00
|
|
|
const methods = [
|
2014-11-16 02:33:20 +00:00
|
|
|
'resolve4',
|
|
|
|
'resolve6',
|
|
|
|
'resolveCname',
|
|
|
|
'resolveMx',
|
|
|
|
'resolveNs',
|
|
|
|
'resolveTxt',
|
|
|
|
'resolveSrv',
|
2016-02-08 09:57:24 +00:00
|
|
|
'resolvePtr',
|
2014-11-16 02:33:20 +00:00
|
|
|
'resolveNaptr',
|
2021-03-26 15:51:08 +00:00
|
|
|
'resolveSoa',
|
2015-05-19 11:00:06 +00:00
|
|
|
];
|
2014-11-16 02:33:20 +00:00
|
|
|
|
|
|
|
methods.forEach(function(method) {
|
2017-01-08 13:19:00 +00:00
|
|
|
const d = domain.create();
|
2014-11-16 02:33:20 +00:00
|
|
|
d.run(function() {
|
2017-10-22 18:07:54 +00:00
|
|
|
dns[method](addresses.INET_HOST, common.mustCall(() => {
|
2017-04-28 01:06:42 +00:00
|
|
|
assert.strictEqual(process.domain, d, `${method} retains domain`);
|
2017-10-22 18:07:54 +00:00
|
|
|
}));
|
2014-11-16 02:33:20 +00:00
|
|
|
});
|
|
|
|
});
|