Adding new naming to test and benchmark
the build was successful Details

This commit is contained in:
Fabian Stamm 2018-12-03 08:30:42 +01:00
parent d16f8c3d8a
commit da5285ac9b
3 changed files with 24 additions and 24 deletions

View File

@ -1,6 +1,6 @@
{
"name": "nodename-core",
"version": "0.3.0",
"version": "0.3.1",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"author": "Fabian Stamm <dev@fabianstamm.de>",

View File

@ -50,7 +50,7 @@ console.timeEnd("complete 10 answers")
class TestMonitoringPlugin implements MonitoringPlugin {
constructor() { }
async init(core) { }
Priority = 0
priority = 0
onRequest(domain, hostname, type) { }
}
@ -81,14 +81,14 @@ class ARR extends RecourceRecord {
class TestQuestionPlugin implements QuestionPlugin {
private Core: DnsCore
QuestionTypes = [RecordTypes.A]
Priority = 0
question_types = [RecordTypes.A]
priority = 0
async init(core) {
this.Core = core;
}
async handleQuestion(question: Question, request: AnswerHandler, next: () => void) {
assert(this.QuestionTypes.find(e => e === <any>question.QTYPE), "Handler was called with not supported question type")
assert(this.question_types.find(e => e === <any>question.QTYPE), "Handler was called with not supported question type")
let parts = question.QNAME.split(".")
let domain = parts.splice(-2, 2).join(".")
let hostname = parts.join(".");
@ -100,7 +100,7 @@ class TestQuestionPlugin implements QuestionPlugin {
class TestListenerPlugin implements ListenerPlugin {
async init(core) { }
Priority = 0;
priority = 0;
callback: (data: Buffer, sender: string, max_size?: number) => Promise<Buffer>;
registerCallback(callback) {
this.callback = callback;
@ -120,9 +120,9 @@ class TestStoragePlugin implements StoragePlugin {
this.re = record;
}
Priority = 0
NoCache = false
RecordTypes = [RecordTypes.A]
priority = 0
no_cache = false
record_types = [RecordTypes.A]
isResponsible(domain: string) {
// console.log("Is responsible")
return true

View File

@ -351,20 +351,20 @@ describe("DNS Core", function () {
core.addListener({
init: async (c) => { assert.exists(c, "Core not defined on Plugin init") },
Priority: 0,
priority: 0,
registerCallback: () => { }
})
core.addMonitoring({
init: async (c) => { assert.exists(c, "Core not defined on Plugin init") },
Priority: 0,
priority: 0,
onRequest: () => { }
})
core.addQuestion({
init: async (c) => { assert.exists(c, "Core not defined on Plugin init") },
QuestionTypes: [RecordTypes.A],
Priority: 0,
question_types: [RecordTypes.A],
priority: 0,
handleQuestion: async () => { },
})
@ -373,9 +373,9 @@ describe("DNS Core", function () {
getRecords: async () => undefined,
init: async (c) => { assert.exists(c, "Core not defined on Plugin init") },
isResponsible: () => true,
NoCache: false,
Priority: 0,
RecordTypes: [RecordTypes.A]
no_cache: false,
priority: 0,
record_types: [RecordTypes.A]
})
return core.start();
@ -425,9 +425,9 @@ class TestStoragePlugin implements StoragePlugin {
this.re = record;
}
Priority = 0
NoCache = false
RecordTypes = [RecordTypes.A]
priority = 0
no_cache = false
record_types = [RecordTypes.A]
isResponsible(domain: string) {
// console.log("Is responsible")
return true
@ -450,7 +450,7 @@ class TestMonitoringPlugin implements MonitoringPlugin {
constructor(private should: { domain: string, hostname: string, type: string }) { }
async init(core) { assert.exists(core, "TestMonitoringPlugin init no core object") }
Priority = 0
priority = 0
onRequest(domain, hostname, type) {
assert.equal(this.should.domain, domain, "Domain value wrong")
assert.equal(this.should.hostname, hostname, "Domain value wrong")
@ -486,15 +486,15 @@ class ARR extends RecourceRecord {
class TestQuestionPlugin implements QuestionPlugin {
private Core: DnsCore
QuestionTypes = [RecordTypes.A]
Priority = 0
question_types = [RecordTypes.A]
priority = 0
async init(core) {
assert.exists(core, "TestQuestionPlugin init no core object")
this.Core = core;
}
async handleQuestion(question: Question, request: AnswerHandler, next: () => void) {
assert(this.QuestionTypes.find(e => e === <any>question.QTYPE), "Handler was called with not supported questin type")
assert(this.question_types.find(e => e === <any>question.QTYPE), "Handler was called with not supported questin type")
let parts = question.QNAME.split(".")
let domain = parts.splice(-2, 2).join(".")
let hostname = parts.join(".");
@ -506,7 +506,7 @@ class TestQuestionPlugin implements QuestionPlugin {
class TestListenerPlugin implements ListenerPlugin {
async init(core) { assert.exists(core, "TestListenerPlugin init no core object") }
Priority = 0;
priority = 0;
callback: (data: Buffer, sender: string, max_size?: number) => Promise<Buffer>;
registerCallback(callback) {
this.callback = callback;