summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrishna Rajendran <krishna@emptybox.org>2010-03-16 04:54:47 -0400
committerRyan Dahl <ry@tinyclouds.org>2010-03-16 10:29:43 -0700
commit3c97a4391af24aea35cb5efa7a40956f7a51d547 (patch)
tree32aac38f77986b4c7ce03f98069245d096ac7d7e
parent3847add9436ce2eb080b9a91dd6955603ac6a714 (diff)
downloadnode-3c97a4391af24aea35cb5efa7a40956f7a51d547.tar.gz
Update test-dns.js to work with latest api
-rw-r--r--test/disabled/test-dns.js42
1 files changed, 24 insertions, 18 deletions
diff --git a/test/disabled/test-dns.js b/test/disabled/test-dns.js
index 675a2c330..53bd23604 100644
--- a/test/disabled/test-dns.js
+++ b/test/disabled/test-dns.js
@@ -21,22 +21,24 @@ while (i--) {
"| sed -E 's/[[:space:]]+/ /g' | cut -d ' ' -f 5- " +
"| sed -e 's/\\.$//'";
- sys.exec(hostCmd).addCallback(checkDnsRecord(hosts[i], records[j]));
+ sys.exec(hostCmd, checkDnsRecord(hosts[i], records[j]));
}
}
function checkDnsRecord(host, record) {
var myHost = host,
myRecord = record;
- return function(stdout) {
- var expected = stdout.substr(0, stdout.length - 1).split("\n");
-
- var resolution = dns.resolve(myHost, myRecord);
+ return function(err, stdout) {
+ var expected = [];
+ if(stdout.length)
+ expected = stdout.substr(0, stdout.length - 1).split("\n");
switch (myRecord) {
case "A":
case "AAAA":
- resolution.addCallback(function (result, ttl, cname) {
+ dns.resolve(myHost, myRecord, function (error, result, ttl, cname) {
+ if(error) result = [];
+
cmpResults(expected, result, ttl, cname);
// do reverse lookup check
@@ -48,12 +50,14 @@ function checkDnsRecord(host, record) {
"| cut -d \" \" -f 5-" +
"| sed -e 's/\\.$//'";
- sys.exec(reverseCmd).addCallback(checkReverse(ip));
+ sys.exec(reverseCmd, checkReverse(ip));
}
});
break;
case "MX":
- resolution.addCallback(function (result, ttl, cname) {
+ dns.resolve(myHost, myRecord, function (error, result, ttl, cname) {
+ if(error) result = [];
+
var strResult = [];
var ll = result.length;
while (ll--) {
@@ -64,7 +68,9 @@ function checkDnsRecord(host, record) {
});
break;
case "TXT":
- resolution.addCallback(function (result, ttl, cname) {
+ dns.resolve(myHost, myRecord, function (error, result, ttl, cname) {
+ if(error) result = [];
+
var strResult = [];
var ll = result.length;
while (ll--) {
@@ -74,7 +80,9 @@ function checkDnsRecord(host, record) {
});
break;
case "SRV":
- resolution.addCallback(function (result, ttl, cname) {
+ dns.resolve(myHost, myRecord, function (error, result, ttl, cname) {
+ if(error) result = [];
+
var strResult = [];
var ll = result.length;
while (ll--) {
@@ -93,15 +101,13 @@ function checkDnsRecord(host, record) {
function checkReverse(ip) {
var myIp = ip;
- return function (stdout) {
+ return function (errr, stdout) {
var expected = stdout.substr(0, stdout.length - 1).split("\n");
- var reversing = dns.reverse(myIp);
-
- reversing.addCallback(
- function (domains, ttl, cname) {
- cmpResults(expected, domains, ttl, cname);
- });
+ reversing = dns.reverse(myIp, function (error, domains, ttl, cname) {
+ if(error) domains = [];
+ cmpResults(expected, domains, ttl, cname);
+ });
}
}
@@ -114,6 +120,6 @@ function cmpResults(expected, result, ttl, cname) {
ll = expected.length;
while (ll--) {
assert.equal(result[ll], expected[ll]);
-// puts("Result " + result[ll] + " was equal to expected " + expected[ll]);
+ puts("Result " + result[ll] + " was equal to expected " + expected[ll]);
}
}