Skip to content

Commit

Permalink
Get publisher unit test passing again #188
Browse files Browse the repository at this point in the history
  • Loading branch information
apertome committed Dec 8, 2020
1 parent 8b1e97d commit 32e72cf
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api/pub/meshconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ exports.get_config = function( configName, options, next, configObj ) {
opts.format = format;
dbTest.init(function(err) {
if(err) throw err;
logger.info("connected to dbTest");
logger.debug("connected to dbTest");
// startProcessing(); //this starts the loop
//config = configObj;
dbTest.Config.findOne({url: configName}).lean().exec(function(err, config) {
Expand All @@ -467,7 +467,7 @@ exports.get_config = function( configName, options, next, configObj ) {
dbTest.disconnect();
return next(err);
} else {
logger.info("Found config with name:"+configName);
logger.debug("Found config with name:"+configName);

}
//config._host_version = req.query.host_version; // TODO: what to do with this?
Expand Down
40 changes: 40 additions & 0 deletions test/data/get_publisher_output.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/node

//mine
var config = require('../etc/config');
const winston = require('winston');

const logger = new winston.Logger(config.logger.winston);
//logger.transports.forEach((t) => (t.silent = true));
var publisher = require('../../api/pub/meshconfig');
//const async = require('async');
//fs = require('fs');

let configName = "throughput3";

let opts = {
"format": "psconfig"
};

function formatlog( obj ) {
var out = JSON.stringify( obj, null, 3 );
return out;
}
function cleanup() {
publisher.dbTest.disconnect();

}

var dbCB = function( err, results ) {
//console.log("CALLBACK err, results", err, "\n");
//console.log(results);
//console.log("RESULTS !!!!\n", formatlog( results ) );
//console.log("RESULTS !!!!\n", JSON.stringify(results, null, 3) );
//console.log("RESULTS !!!!\n", JSON.stringify(results));
console.log(JSON.stringify(results));
//console.log("ERRRR !!!!\n", err );
cleanup();

};

publisher.get_config( configName, opts, dbCB, config );
2 changes: 1 addition & 1 deletion test/data/throughput3-expected.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"archives":{"host-additional-archive0":{"archiver":"esmond","data":{"url":"qwerty","measurement-agent":"{% scheduled_by_address %}","schema":1}},"host-archive0":{"archiver":"esmond","data":{"url":"https://perfsonar-dev9.grnoc.iu.edu/esmond/perfsonar/archive","measurement-agent":"{% scheduled_by_address %}","schema":1}},"host-additional-archive1":{"archiver":"esmond","data":{"url":"https://perfsonar-dev99.grnoc.iu.edu/esmond/perfsonar/archive","measurement-agent":"{% scheduled_by_address %}","schema":1}},"host-archive1":{"archiver":"esmond","data":{"url":"https://perf-yamaguchi.sinet.ad.jp/esmond/perfsonar/archive","measurement-agent":"{% scheduled_by_address %}","schema":1}}},"addresses":{"test-pt1.es.net":{"address":"test-pt1.es.net","host":"test-pt1.es.net","_meta":{"display-name":"(OWAMP Server at es.net)","display-url":"https://test-pt1.es.net/toolkit/"}},"perfsonar-dev8.grnoc.iu.edu":{"address":"perfsonar-dev8.grnoc.iu.edu","host":"perfsonar-dev8.grnoc.iu.edu","_meta":{"display-name":"GlobalNOC","display-url":"https://perfsonar-dev8.grnoc.iu.edu/toolkit/"}},"perfsonar.cbio.uct.ac.za":{"address":"perfsonar.cbio.uct.ac.za","host":"perfsonar.cbio.uct.ac.za","_meta":{"display-name":"cbio host descr!!!! use local ma!!!","display-url":"https://perfsonar.cbio.uct.ac.za/toolkit/"}},"snla-opt1.es.net":{"address":"snla-opt1.es.net","host":"snla-opt1.es.net","_meta":{"display-name":"Sandia National Laboratory - Albuquerque","display-url":"https://snla-opt1.es.net/toolkit/"}},"perfsonar-dev9.grnoc.iu.edu":{"address":"perfsonar-dev9.grnoc.iu.edu","host":"perfsonar-dev9.grnoc.iu.edu","_meta":{"display-name":"ps dev 9!!","display-url":"https://perfsonar-dev9.grnoc.iu.edu/toolkit/"}},"perf-yamaguchi.sinet.ad.jp":{"address":"perf-yamaguchi.sinet.ad.jp","host":"perf-yamaguchi.sinet.ad.jp","_meta":{"display-name":"Science Information Network - SINET","display-url":"https://perf-yamaguchi.sinet.ad.jp/toolkit/"}}},"groups":{"throughput3":{"type":"mesh","addresses":[{"name":"test-pt1.es.net"},{"name":"perfsonar-dev8.grnoc.iu.edu"},{"name":"perfsonar.cbio.uct.ac.za"}]},"this little pingy":{"type":"mesh","addresses":[{"name":"snla-opt1.es.net"},{"name":"perfsonar-dev9.grnoc.iu.edu"}]},"lat4 444":{"type":"mesh","addresses":[{"name":"perfsonar-dev8.grnoc.iu.edu"},{"name":"perf-yamaguchi.sinet.ad.jp"}]},"tput4 protocol udp probe_type tcp":{"type":"mesh","addresses":[{"name":"test-pt1.es.net"},{"name":"perfsonar-dev8.grnoc.iu.edu"},{"name":"perfsonar.cbio.uct.ac.za"}]},"throughput5":{"type":"mesh","addresses":[{"name":"test-pt1.es.net"},{"name":"perfsonar-dev8.grnoc.iu.edu"},{"name":"perfsonar.cbio.uct.ac.za"}]}},"tests":{"throughput3":{"type":"throughput","spec":{"duration":"PT20S","source":"{% address[0] %}","dest":"{% address[1] %}","single-ended":true,"omit":"PT5S","ip-version":4,"schema":2}},"this little pingy":{"type":"rtt","spec":{"fragment":true,"source":"{% address[0] %}","dest":"{% address[1] %}","suppress-loopback":true,"schema":3}},"lat4 444":{"type":"latency","spec":{"reverse":true,"source":"{% address[0] %}","dest":"{% address[1] %}","packet-interval":0.1,"bucket-width":0.001,"packet-count":600,"ip-version":4,"schema":2}},"tput4 protocol udp probe_type tcp":{"type":"throughput","spec":{"duration":"PT20S","source":"{% address[0] %}","dest":"{% address[1] %}","udp":true,"ip-version":4,"schema":1}},"throughput5":{"type":"throughput","spec":{"duration":"PT20S","source":"{% address[0] %}","dest":"{% address[1] %}","omit":"PT5S","udp":true,"ip-version":4,"schema":1}}},"schedules":{"sched-0":{"repeat":"PT3H53M18S","sliprand":true},"sched-1":{"repeat":"PT4H10M","sliprand":true},"sched-2":{"repeat":"PT1H","sliprand":true,"slip":"PT20M"},"sched-3":{"repeat":"PT4H","sliprand":true},"sched-4":{"repeat":"PT4H","sliprand":true,"slip":"PT26M41S"}},"tasks":{"throughput3":{"group":"throughput3","test":"throughput3","archives":[],"_meta":{"display-name":"throughput3"},"schedule":"sched-0","tools":["bwctliperf3","iperf3"]},"this little pingy":{"group":"this little pingy","test":"this little pingy","archives":[],"_meta":{"display-name":"this little pingy"},"schedule":"sched-1"},"lat4 444":{"group":"lat4 444","test":"lat4 444","archives":[],"_meta":{"display-name":"lat4 444"},"schedule":"sched-2","tools":["owping"]},"tput4 protocol udp probe_type tcp":{"group":"tput4 protocol udp probe_type tcp","test":"tput4 protocol udp probe_type tcp","archives":[],"_meta":{"display-name":"tput4 protocol udp probe_type tcp"},"schedule":"sched-3","tools":["bwctliperf3","iperf3"]},"throughput5":{"group":"throughput5","test":"throughput5","archives":[],"_meta":{"display-name":"throughput5"},"schedule":"sched-4","tools":["bwctliperf3","iperf3"]}},"_meta":{"display-name":"in pwa-test1 db"},"hosts":{"test-pt1.es.net":{},"perfsonar-dev8.grnoc.iu.edu":{},"perfsonar.cbio.uct.ac.za":{"archives":["host-additional-archive0"]},"snla-opt1.es.net":{},"perfsonar-dev9.grnoc.iu.edu":{"archives":["host-archive0","host-additional-archive1"]},"perf-yamaguchi.sinet.ad.jp":{"archives":["host-archive1"]}}}
{"archives":{"host-additional-archive0":{"archiver":"esmond","data":{"url":"qwerty","measurement-agent":"{% scheduled_by_address %}","schema":1}},"host-archive0":{"archiver":"esmond","data":{"url":"https://perfsonar-dev9.grnoc.iu.edu/esmond/perfsonar/archive","measurement-agent":"{% scheduled_by_address %}","schema":1}},"host-additional-archive1":{"archiver":"esmond","data":{"url":"https://perfsonar-dev99.grnoc.iu.edu/esmond/perfsonar/archive","measurement-agent":"{% scheduled_by_address %}","schema":1}},"host-archive3":{"archiver":"esmond","data":{"url":"https://perf-yamaguchi.sinet.ad.jp/esmond/perfsonar/archive","measurement-agent":"{% scheduled_by_address %}","schema":1}}},"addresses":{"test-pt1.es.net":{"address":"test-pt1.es.net","host":"test-pt1.es.net","_meta":{"display-name":"(OWAMP Server at es.net)","display-url":"https://test-pt1.es.net/toolkit/"}},"perfsonar-dev8.grnoc.iu.edu":{"address":"perfsonar-dev8.grnoc.iu.edu","host":"perfsonar-dev8.grnoc.iu.edu","_meta":{"display-name":"GlobalNOC","display-url":"https://perfsonar-dev8.grnoc.iu.edu/toolkit/"}},"perfsonar.cbio.uct.ac.za":{"address":"perfsonar.cbio.uct.ac.za","host":"perfsonar.cbio.uct.ac.za","_meta":{"display-name":"cbio host descr!!!! use local ma!!!","display-url":"https://perfsonar.cbio.uct.ac.za/toolkit/"}},"snla-opt1.es.net":{"address":"snla-opt1.es.net","host":"snla-opt1.es.net","_meta":{"display-name":"Sandia National Laboratory - Albuquerque","display-url":"https://snla-opt1.es.net/toolkit/"}},"perfsonar-dev9.grnoc.iu.edu":{"address":"perfsonar-dev9.grnoc.iu.edu","host":"perfsonar-dev9.grnoc.iu.edu","_meta":{"display-name":"ps dev 9!!","display-url":"https://perfsonar-dev9.grnoc.iu.edu/toolkit/"}},"perf-yamaguchi.sinet.ad.jp":{"address":"perf-yamaguchi.sinet.ad.jp","host":"perf-yamaguchi.sinet.ad.jp","_meta":{"display-name":"Science Information Network - SINET","display-url":"https://perf-yamaguchi.sinet.ad.jp/toolkit/"}}},"groups":{"throughput3":{"type":"mesh","addresses":[{"name":"test-pt1.es.net"},{"name":"perfsonar-dev8.grnoc.iu.edu"},{"name":"perfsonar.cbio.uct.ac.za"}]},"this little pingy":{"type":"mesh","addresses":[{"name":"snla-opt1.es.net"},{"name":"perfsonar-dev9.grnoc.iu.edu"}]},"lat4 444":{"type":"mesh","addresses":[{"name":"perfsonar-dev8.grnoc.iu.edu"},{"name":"perf-yamaguchi.sinet.ad.jp"}]}},"tests":{"throughput3":{"type":"throughput","spec":{"duration":"PT20S","source":"{% address[0] %}","dest":"{% address[1] %}","single-ended":true,"omit":"PT5S","ip-version":4,"schema":2}},"this little pingy":{"type":"rtt","spec":{"fragment":true,"source":"{% address[0] %}","dest":"{% address[1] %}","suppress-loopback":true,"schema":3}},"lat4 444":{"type":"latency","spec":{"reverse":true,"source":"{% address[0] %}","dest":"{% address[1] %}","packet-interval":0.1,"bucket-width":0.001,"packet-count":600,"ip-version":4,"schema":2}}},"schedules":{"sched-0":{"repeat":"PT3H53M18S","sliprand":true,"slip":"PT1H56M39S"},"sched-1":{"repeat":"PT4H10M","sliprand":true,"slip":"PT2H5M"},"sched-2":{"repeat":"PT1H","sliprand":true,"slip":"PT20M"}},"tasks":{"throughput3":{"group":"throughput3","test":"throughput3","archives":[],"_meta":{"display-name":"throughput3"},"schedule":"sched-0","tools":["bwctliperf3","iperf3"]},"this little pingy":{"group":"this little pingy","test":"this little pingy","archives":[],"_meta":{"display-name":"this little pingy"},"schedule":"sched-1"},"lat4 444":{"group":"lat4 444","test":"lat4 444","archives":[],"_meta":{"display-name":"lat4 444"},"schedule":"sched-2","tools":["owping"]}},"_meta":{"display-name":"in pwa-test1 db"},"hosts":{"test-pt1.es.net":{},"perfsonar-dev8.grnoc.iu.edu":{},"perfsonar.cbio.uct.ac.za":{"archives":["host-additional-archive0"]},"snla-opt1.es.net":{},"perfsonar-dev9.grnoc.iu.edu":{"archives":["host-archive0","host-additional-archive1"]},"perf-yamaguchi.sinet.ad.jp":{"archives":["host-archive3"]}}}
11 changes: 5 additions & 6 deletions test/publisher.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
console.log("NOTE: db mca copied to pwa-test1");
//contrib
var assert = require('assert');
var chai = require('chai');
Expand All @@ -25,17 +24,17 @@ var testsObj = {
"tests.throughput3.spec.single-ended": true,
"tests.this little pingy.spec.schema": 3,
"tests.lat4 444.spec.schema": 2,
"tests.tput4 protocol udp probe_type tcp.spec.schema": 1,
"tests.tput4 protocol udp probe_type tcp.spec.udp": true,
"tests.throughput5.spec.schema": 1,
"tests.throughput5.spec.udp": true,
//"tests.tput4 protocol udp probe_type tcp.spec.schema": 1,
//"tests.tput4 protocol udp probe_type tcp.spec.udp": true,
//"tests.throughput5.spec.schema": 1,
//"tests.throughput5.spec.udp": true,
"archives.host-additional-archive0.data.schema": 1,
"archives.host-additional-archive1.data.schema": 1,
"archives.host-archive0.archiver": "esmond",
"archives.host-archive0.data.schema": 1,
"archives.host-archive0.data.url": "https://perfsonar-dev9.grnoc.iu.edu/esmond/perfsonar/archive",
"archives.host-archive0.data.measurement-agent": "{% scheduled_by_address %}",
"archives.host-archive1.data.schema": 1,
//"archives.host-archive1.data.schema": 1,
},
should_not_exist: [
"tests.throughput3.spec.udp",
Expand Down

0 comments on commit 32e72cf

Please sign in to comment.