1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

github test fix

This commit is contained in:
Massimo Candela
2022-08-11 17:47:15 +02:00
parent 639057a378
commit 5e5330f7c4
3 changed files with 12 additions and 11 deletions

View File

@@ -36,7 +36,7 @@ export default class MonitorROAS extends Monitor {
} }
if (this.enableExpirationAlerts || this.enableExpirationCheckTA) { if (this.enableExpirationAlerts || this.enableExpirationCheckTA) {
(global.EXTERNAL_ROA_EXPIRATION_TEST ? setTimeout : setInterval)(() => { setInterval(() => {
this.rpki._getVrpIndex() this.rpki._getVrpIndex()
.then(index => { .then(index => {
this._verifyExpiration(index, this.roaExpirationAlertHours); // Verify expiration with enrichment this._verifyExpiration(index, this.roaExpirationAlertHours); // Verify expiration with enrichment

View File

@@ -34,20 +34,15 @@ const chai = require("chai");
const chaiSubset = require('chai-subset'); const chaiSubset = require('chai-subset');
const fs = require('fs'); const fs = require('fs');
const expect = chai.expect; const expect = chai.expect;
const asyncTimeout = 200000; const asyncTimeout = 270000;
chai.use(chaiSubset); chai.use(chaiSubset);
global.EXTERNAL_CONFIG_FILE = "tests/rpki_tests/config.rpki.test.external-roas.yml"; global.EXTERNAL_CONFIG_FILE = "tests/rpki_tests/config.rpki.test.external-roas.yml";
global.EXTERNAL_ROA_EXPIRATION_TEST = 10000; global.EXTERNAL_ROA_EXPIRATION_TEST = 90000;
// ROAs before // ROAs before
fs.copyFileSync("tests/rpki_tests/roas.before.json", "tests/rpki_tests/roas.json"); fs.copyFileSync("tests/rpki_tests/roas.before.json", "tests/rpki_tests/roas.json");
setTimeout(() => {
// ROAs after
fs.copyFileSync("tests/rpki_tests/roas.after.json", "tests/rpki_tests/roas.json");
}, 30000);
const worker = require("../../index"); const worker = require("../../index");
const pubSub = worker.pubSub; const pubSub = worker.pubSub;
@@ -143,5 +138,11 @@ describe("RPKI monitoring external", function() {
} }
}); });
setTimeout(() => {
// ROAs after
fs.copyFileSync("tests/rpki_tests/roas.after.json", "tests/rpki_tests/roas.json");
}, global.EXTERNAL_ROA_EXPIRATION_TEST + 10000);
}).timeout(asyncTimeout); }).timeout(asyncTimeout);
}); });

View File

@@ -46,9 +46,6 @@ const pubSub = worker.pubSub;
describe("RPKI monitoring external", function() { describe("RPKI monitoring external", function() {
//Test rpki watch file reloading
fs.copyFileSync("tests/rpki_tests/vrp.correct.json", "tests/rpki_tests/vrp.json");
it("external connector", function (done) { it("external connector", function (done) {
const expectedData = { const expectedData = {
@@ -97,6 +94,9 @@ describe("RPKI monitoring external", function() {
} }
}); });
//Test rpki watch file reloading
fs.copyFileSync("tests/rpki_tests/vrp.correct.json", "tests/rpki_tests/vrp.json");
setTimeout(() => { // Wait that the watcher realizes the file changed setTimeout(() => { // Wait that the watcher realizes the file changed
pubSub.publish("test-type", "rpki"); pubSub.publish("test-type", "rpki");
started = true; started = true;