better debugging

This commit is contained in:
Girish Ramakrishnan 2015-09-29 21:39:11 -07:00
parent 5a2e494352
commit 379a8bcabb
2 changed files with 8 additions and 6 deletions

View File

@ -263,7 +263,7 @@ Cloudron.prototype.checkA = function (callback) {
if (records[0] !== that._box.ip) return callback(new Error('Bad A record. ' + records[0] + '. Expecting ' + that._box.ip));
callback();
callback(null, records);
});
};
@ -275,7 +275,7 @@ Cloudron.prototype.checkSPF = function (callback) {
if (records[0][0].search(new RegExp('^v=spf1 ip4:' + that._box.ip + ' ~all$')) !== 0) return callback(new Error('Bad SPF record. ' + records[0][0]));
callback();
callback(null, records);
});
};
@ -287,7 +287,7 @@ Cloudron.prototype.checkDKIM = function (callback) {
// node removes the quotes or maybe this is why a 2d-array?
if (records[0][0].search(/^v=DKIM1; t=s; p=.*$/) !== 0) return callback(new Error('Bad DKIM record. ' + records[0][0]));
callback();
callback(null, records);
});
};
@ -299,7 +299,7 @@ Cloudron.prototype.checkDMARC = function (callback) {
// node removes the quotes or maybe this is why a 2d-array?
if (records[0][0].search(/^v=DMARC1; p=none; pct=100; rua=mailto:.*; ruf=.*$/) !== 0) return callback(new Error('Bad DMARC record. ' + records[0][0]));
callback();
callback(null, records);
});
};

View File

@ -99,11 +99,13 @@ describe('Appstore new user flow', function () {
});
it('has setup DNS records cleaned up', function (done) {
dns.setServers([ '8.8.8.8' ]); // use different dns server so as to not get cached results
dns.setServers([ '205.251.199.12' ]); // use different dns server so as to not get cached results
function expectError(tag, fn) {
return function (cb) {
fn(function (error) {
fn(function (error, records) {
if (!error) console.error('Records of %s is %j', tag, records);
cb(error ? null : new Error('Expecting error for ' + tag));
});
};