test: 优化dns测试用例 2
parent
d52b65618a
commit
46024e5c4d
|
@ -14,7 +14,7 @@ function parseVersion (version) {
|
||||||
* @param log 日志对象
|
* @param log 日志对象
|
||||||
* @returns {number} 比较线上版本号是否为更新的版本,大于0=是|0=相等|小于0=否|-999=出现异常,比较结果未知
|
* @returns {number} 比较线上版本号是否为更新的版本,大于0=是|0=相等|小于0=否|-999=出现异常,比较结果未知
|
||||||
*/
|
*/
|
||||||
export function isNewVersion (onlineVersion, currentVersion, log = console) {
|
export function isNewVersion (onlineVersion, currentVersion, log = null) {
|
||||||
if (onlineVersion === currentVersion) {
|
if (onlineVersion === currentVersion) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,6 +111,14 @@ console.log('\n--------------- test ForSNI ---------------\n')
|
||||||
console.log(`===> test ForSNI: ${dnsProviders.ForSNI.dnsName}`, '\n\n')
|
console.log(`===> test ForSNI: ${dnsProviders.ForSNI.dnsName}`, '\n\n')
|
||||||
assert.strictEqual(dnsProviders.ForSNI, dnsProviders.safe360)
|
assert.strictEqual(dnsProviders.ForSNI, dnsProviders.safe360)
|
||||||
|
|
||||||
|
const dnsProviders2 = dns.initDNS({
|
||||||
|
aliyun: {
|
||||||
|
server: 'udp://223.5.5.5',
|
||||||
|
},
|
||||||
|
}, {})
|
||||||
|
console.log(`===> test ForSNI2: ${dnsProviders2.ForSNI.dnsName}`, '\n\n')
|
||||||
|
assert.strictEqual(dnsProviders2.ForSNI, dnsProviders2.PreSet) // 未配置forSNI的DNS时,默认使用PreSet作为ForSNI
|
||||||
|
|
||||||
|
|
||||||
console.log('\n--------------- test PreSet ---------------\n')
|
console.log('\n--------------- test PreSet ---------------\n')
|
||||||
ip = await dnsProviders.PreSet.lookup(hasPresetHostname)
|
ip = await dnsProviders.PreSet.lookup(hasPresetHostname)
|
||||||
|
|
Loading…
Reference in New Issue