mirror of
https://github.com/nttgin/BGPalerter.git
synced 2024-05-19 06:50:08 +00:00
run reports test in parallel
This commit is contained in:
@@ -7,13 +7,15 @@ jobs:
|
||||
- stage: "Tests"
|
||||
name: "Tests without proxy"
|
||||
script: npm run test
|
||||
- name: "Tests reports"
|
||||
script: npm run test-reports
|
||||
- name: "Tests with proxy"
|
||||
before_script:
|
||||
- npm install -g anyproxy
|
||||
- nohup anyproxy --port 8001 &
|
||||
- ANYPROXY_PID=$!
|
||||
script:
|
||||
- ./node_modules/.bin/mocha --exit tests/proxy_tests/*.js --require @babel/register
|
||||
- npm run test-proxy
|
||||
after_script:
|
||||
- kill $ANYPROXY_PID
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
"scripts": {
|
||||
"babel": "./node_modules/.bin/babel",
|
||||
"test": "rm -rf volumetests/ && ./node_modules/.bin/mocha --exit tests/*.js --require @babel/register && rm -rf volumetests/",
|
||||
"test-reports": "./node_modules/.bin/mocha --exit tests/reports_tests/*.js --require @babel/register",
|
||||
"test-proxy": "./node_modules/.bin/mocha --exit tests/proxy_tests/*.js --require @babel/register",
|
||||
"build": "./build.sh",
|
||||
"watch-and-serve": "nodemon -e yml,js,json,txt --inspect --exec babel-node index.js",
|
||||
"serve": "babel-node index.js",
|
||||
|
||||
@@ -35,8 +35,6 @@ import {AS, Path} from "../model";
|
||||
|
||||
export default class ConnectorTest extends Connector{
|
||||
|
||||
static isTest = true;
|
||||
|
||||
constructor(name, params, env) {
|
||||
super(name, params, env);
|
||||
this.pubSub.subscribe("test-type", (type, message) => {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
const chai = require("chai");
|
||||
const fs = require("fs");
|
||||
const chaiSubset = require('chai-subset');
|
||||
const Syslogd = require("syslogd");
|
||||
chai.use(chaiSubset);
|
||||
const expect = chai.expect;
|
||||
const volume = "volumetests/";
|
||||
@@ -41,9 +42,10 @@ const asyncTimeout = 20000;
|
||||
global.EXTERNAL_VERSION_FOR_TEST = "0.0.1";
|
||||
global.EXTERNAL_CONFIG_FILE = volume + "config.test.yml";
|
||||
|
||||
const worker = require("../index");
|
||||
const pubSub = worker.pubSub;
|
||||
|
||||
describe("Alerting", function () {
|
||||
var worker = require("../index");
|
||||
var pubSub = worker.pubSub;
|
||||
|
||||
it("visibility reporting", function(done) {
|
||||
|
||||
|
||||
@@ -60,26 +60,6 @@ reports:
|
||||
persistAlertData: false
|
||||
alertDataDirectory: alertdata/
|
||||
|
||||
- file: reportSyslog
|
||||
channels:
|
||||
- hijack
|
||||
- newprefix
|
||||
- visibility
|
||||
- path
|
||||
- asn-monitor
|
||||
- misconfiguration
|
||||
- rpki
|
||||
params:
|
||||
host: 127.0.0.1
|
||||
port: 516
|
||||
transport: udp
|
||||
templates: # See here how to write a template https://github.com/nttgin/BGPalerter/blob/master/docs/context.md
|
||||
default: "++BGPalerter-3-${type}: ${summary}|${earliest}|${latest}"
|
||||
hijack: "++BGPalerter-5-${type}: ${summary}|${prefix}|${description}|${asn}|${newprefix}|${neworigin}|${earliest}|${latest}|${peers}"
|
||||
newprefix: "++BGPalerter-4-${type}: ${summary}|${prefix}|${description}|${asn}|${newprefix}|${neworigin}|${earliest}|${latest}|${peers}"
|
||||
visibility: "++BGPalerter-5-${type}: ${summary}|${prefix}|${description}|${asn}|${earliest}|${latest}|${peers}"
|
||||
misconfiguration: "++BGPalerter-3-${type}: ${summary}|${asn}|${prefix}|${earliest}|${latest}"
|
||||
|
||||
|
||||
# The file containing the monitored prefixes. Please see monitored_prefixes_test.yml for an example
|
||||
# This is an array (use new lines and dashes!)
|
||||
|
||||
95
tests/reports_tests/config.reports.test.yml
Normal file
95
tests/reports_tests/config.reports.test.yml
Normal file
@@ -0,0 +1,95 @@
|
||||
environment: test
|
||||
|
||||
connectors:
|
||||
- file: connectorTest
|
||||
name: tes
|
||||
params:
|
||||
testType: withdrawal
|
||||
|
||||
monitors:
|
||||
- file: monitorHijack
|
||||
channel: hijack
|
||||
name: basic-hijack-detection
|
||||
params:
|
||||
thresholdMinPeers: 0
|
||||
|
||||
- file: monitorNewPrefix
|
||||
channel: newprefix
|
||||
name: prefix-detection
|
||||
params:
|
||||
thresholdMinPeers: 0
|
||||
|
||||
- file: monitorVisibility
|
||||
channel: visibility
|
||||
name: withdrawal-detection
|
||||
params:
|
||||
thresholdMinPeers: 4
|
||||
|
||||
- file: monitorPath
|
||||
channel: path
|
||||
name: path-matching
|
||||
params:
|
||||
thresholdMinPeers: 0
|
||||
|
||||
- file: monitorAS
|
||||
channel: misconfiguration
|
||||
name: asn-monitor
|
||||
params:
|
||||
thresholdMinPeers: 2
|
||||
|
||||
- file: monitorRPKI
|
||||
channel: rpki
|
||||
name: rpki-monitor
|
||||
params:
|
||||
thresholdMinPeers: 1
|
||||
preCacheROAs: false
|
||||
refreshVrpListMinutes: 15
|
||||
checkUncovered: true
|
||||
|
||||
|
||||
reports:
|
||||
- file: reportSyslog
|
||||
channels:
|
||||
- hijack
|
||||
- newprefix
|
||||
- visibility
|
||||
- path
|
||||
- asn-monitor
|
||||
- misconfiguration
|
||||
- rpki
|
||||
params:
|
||||
host: 127.0.0.1
|
||||
port: 516
|
||||
transport: udp
|
||||
templates: # See here how to write a template https://github.com/nttgin/BGPalerter/blob/master/docs/context.md
|
||||
default: "++BGPalerter-3-${type}: ${summary}|${earliest}|${latest}"
|
||||
hijack: "++BGPalerter-5-${type}: ${summary}|${prefix}|${description}|${asn}|${newprefix}|${neworigin}|${earliest}|${latest}|${peers}"
|
||||
newprefix: "++BGPalerter-4-${type}: ${summary}|${prefix}|${description}|${asn}|${newprefix}|${neworigin}|${earliest}|${latest}|${peers}"
|
||||
visibility: "++BGPalerter-5-${type}: ${summary}|${prefix}|${description}|${asn}|${earliest}|${latest}|${peers}"
|
||||
misconfiguration: "++BGPalerter-3-${type}: ${summary}|${asn}|${prefix}|${earliest}|${latest}"
|
||||
|
||||
|
||||
# The file containing the monitored prefixes. Please see monitored_prefixes_test.yml for an example
|
||||
# This is an array (use new lines and dashes!)
|
||||
monitoredPrefixesFiles:
|
||||
- tests/prefixes.test.yml
|
||||
|
||||
logging:
|
||||
directory: logs
|
||||
logRotatePattern: YYYY-MM-DD # Whenever the pattern changes, a new file is created and the old one rotated
|
||||
backlogSize: 1
|
||||
maxRetainedFiles: 10
|
||||
maxFileSizeMB: 15
|
||||
compressOnRotation: true
|
||||
|
||||
checkForUpdatesAtBoot: false
|
||||
persistStatus: false
|
||||
|
||||
|
||||
notificationIntervalSeconds: 1800 # Repeat the same alert (which keeps being triggered) after x seconds
|
||||
alertOnlyOnce: false
|
||||
fadeOffSeconds: 10
|
||||
checkFadeOffGroupsSeconds: 2
|
||||
pidFile: bgpalerter.pid
|
||||
multiProcess: false
|
||||
maxMessagesPerSecond: 6000
|
||||
@@ -39,13 +39,13 @@ const expect = chai.expect;
|
||||
const volume = "volumetests/";
|
||||
const asyncTimeout = 20000;
|
||||
global.EXTERNAL_VERSION_FOR_TEST = "0.0.1";
|
||||
global.EXTERNAL_CONFIG_FILE = volume + "config.test.yml";
|
||||
global.EXTERNAL_CONFIG_FILE = "tests/reports_tests/config.reports.test.yml";
|
||||
|
||||
describe("Reports", function() {
|
||||
var worker = require("../index");
|
||||
var pubSub = worker.pubSub;
|
||||
const worker = require("../../index");
|
||||
const pubSub = worker.pubSub;
|
||||
|
||||
it("Syslog", function (done) {
|
||||
it("syslog", function (done) {
|
||||
let doneCalled = false;
|
||||
|
||||
Syslogd(function(info) {
|
||||
Reference in New Issue
Block a user