mirror of
https://github.com/amark/gun.git
synced 2026-03-04 08:15:25 +00:00
PANIC tests + AXE get dedup + fix DAM add by id
This commit is contained in:
2
gun.js
2
gun.js
@@ -1596,7 +1596,7 @@
|
||||
|
||||
mesh.hi = function(peer){
|
||||
var wire = peer.wire, tmp;
|
||||
if(!wire){ mesh.wire((peer.length && {url: peer}) || peer); return }
|
||||
if(!wire){ mesh.wire((peer.length && {url: peer, id: peer}) || peer); return }
|
||||
if(peer.id){
|
||||
opt.peers[peer.url || peer.id] = peer;
|
||||
} else {
|
||||
|
||||
@@ -38,6 +38,7 @@ function start(root){
|
||||
GET.turn = function(msg, route, turn){
|
||||
var tmp = msg['#'], tag = dup.s[tmp], next;
|
||||
if(!tmp || !tag){ return } // message timed out, GUN may require us to relay, tho AXE does not like that. Rethink?
|
||||
// TOOD: BUG! Handle edge case where live updates occur while these turn hashes are being checked (they'll never be consistent), but we don't want to degrade to O(N), if we know the via asking peer got an update, then we should do something like cancel these turns asking for data.
|
||||
// Ideas: Save a random seed that sorts the route, store it and the index. // Or indexing on lowest latency is probably better.
|
||||
clearTimeout(tag.lack);
|
||||
if(tag.ack && (tmp = tag['##']) && msg['##'] === tmp){ return } // hashes match, stop asking other peers!
|
||||
@@ -151,6 +152,7 @@ function start(root){
|
||||
var peers = [];Object.keys(axe.up).forEach(function(p){ p = axe.up[p]; p.url && peers.push(p.url) });
|
||||
//console.log(Object.port, 'mobbed?', peer.pid, opt.mob, count, Object.keys(opt.peers)+'', 'bye', peer.pid || peer.id);
|
||||
if(!peers.length){ return }
|
||||
// TODO: BUG!!! Infinite reconnection loop happens if not enough relays, or if some are missing. For instance, :8766 says to connect to :8767 which then says to connect to :8766. To not DDoS when system overload, figure clever way to tell peers to retry later, that network does not have enough capacity?
|
||||
mesh.say({dam: 'mob', mob: count, peers: peers}, peer);
|
||||
//setTimeout(function(){ mesh.bye(peer) }, 9); // something with better perf? // UNCOMMENT WHEN WE ACTIVATE THIS FEATURE
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
servers: 2,
|
||||
relays: 2,
|
||||
browsers: 2,
|
||||
route: {
|
||||
'/': __dirname + '/index.html',
|
||||
@@ -40,7 +40,7 @@ var clients = panic.clients;
|
||||
var manager = require('panic-manager')();
|
||||
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){
|
||||
clients: Array(config.relays).fill().map(function(u, i){
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1)
|
||||
@@ -49,10 +49,10 @@ manager.start({
|
||||
panic: 'http://' + config.IP + ':' + config.port
|
||||
});
|
||||
|
||||
var servers = clients.filter('Node.js');
|
||||
var bob = servers.pluck(1);
|
||||
var carl = servers.excluding(bob).pluck(1);
|
||||
var browsers = clients.excluding(servers);
|
||||
var relays = clients.filter('Node.js');
|
||||
var bob = relays.pluck(1);
|
||||
var carl = relays.excluding(bob).pluck(1);
|
||||
var browsers = clients.excluding(relays);
|
||||
var alice = browsers.pluck(1);
|
||||
var dave = browsers.excluding(alice).pluck(1);
|
||||
|
||||
@@ -61,13 +61,13 @@ describe("Put ACK", function(){
|
||||
//this.timeout(5 * 60 * 1000);
|
||||
this.timeout(10 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
return servers.atLeast(config.servers);
|
||||
it("Relays have joined!", function(){
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN started!", function(){
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
@@ -78,7 +78,7 @@ describe("Put ACK", function(){
|
||||
});
|
||||
var port = env.config.port + env.i;
|
||||
var Gun; try{ Gun = require('gun') }catch(e){ console.log("GUN not found! You need to link GUN to PANIC. Nesting the `gun` repo inside a `node_modules` parent folder often fixes this.") }
|
||||
var peers = [], i = env.config.servers;
|
||||
var peers = [], i = env.config.relays;
|
||||
while(i--){
|
||||
var tmp = (env.config.port + (i + 1));
|
||||
if(port != tmp){ // ignore ourselves
|
||||
@@ -138,10 +138,10 @@ describe("Put ACK", function(){
|
||||
var dam = ref.back('opt.mesh');
|
||||
var hear = dam.hear;
|
||||
dam.hear = function(raw, peer){ // hijack the listener
|
||||
try{var msg = JSON.parse(raw);
|
||||
var msg; try{msg = JSON.parse(raw);
|
||||
}catch(e){ console.log("Note: This test not support RAD serialization format yet, use JSON.") }
|
||||
hear(raw, peer);
|
||||
ref.hear.push(msg); // add to count
|
||||
ref.hear.push(msg || raw); // add to count
|
||||
}
|
||||
var say = dam.say;
|
||||
dam.say = function(raw, peer){
|
||||
@@ -151,7 +151,7 @@ describe("Put ACK", function(){
|
||||
(ref.say || (ref.say = [])).push(JSON.parse(msg)); // add to count.
|
||||
}
|
||||
}
|
||||
}, {acks: config.servers});
|
||||
}, {acks: config.relays});
|
||||
});
|
||||
|
||||
it("Get", function(){
|
||||
@@ -191,7 +191,7 @@ describe("Put ACK", function(){
|
||||
clearTimeout(to);
|
||||
to = setTimeout(test.done, 1000);
|
||||
});
|
||||
}, {acks: config.servers});
|
||||
}, {acks: config.relays});
|
||||
});
|
||||
|
||||
it("DAM", function(){
|
||||
@@ -200,7 +200,7 @@ describe("Put ACK", function(){
|
||||
if(ref.hear.length > 1){ return heard_to_much } // Alice should hear the GET
|
||||
if(ref.say){ return said_too_much } // But should not reply because their reply hash dedups with an earlier reply that was added to the GET.
|
||||
test.done()
|
||||
}, {acks: config.servers});
|
||||
}, {acks: config.relays});
|
||||
});
|
||||
|
||||
it("All finished!", function(done){
|
||||
@@ -212,7 +212,7 @@ describe("Put ACK", function(){
|
||||
|
||||
after("Everything shut down.", function(){
|
||||
require('./util/open').cleanup();
|
||||
return servers.run(function(){
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
This test is almost the opposite of the first test.
|
||||
1. Alice saves data ""offline"" so nobody knows it exists.
|
||||
2. Then Carl & Dave simultaneously ask for it, even tho they are not connected to Alice and Bob does not know where it is.
|
||||
3. They must receive the data, and their requests must conflict or cause the other's to drop.
|
||||
3. They must receive the data, and their requests must not conflict or cause the other's to drop.
|
||||
4. Optionally: Then Ed comes along and asks for the data again, he must receive it from the closest cached peer.
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
servers: 1,
|
||||
relays: 1,
|
||||
browsers: 4,
|
||||
route: {
|
||||
'/': __dirname + '/index.html',
|
||||
@@ -30,7 +30,7 @@ var clients = panic.clients;
|
||||
var manager = require('panic-manager')();
|
||||
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){
|
||||
clients: Array(config.relays).fill().map(function(u, i){
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1)
|
||||
@@ -39,9 +39,9 @@ manager.start({
|
||||
panic: 'http://' + config.IP + ':' + config.port
|
||||
});
|
||||
|
||||
var servers = clients.filter('Node.js');
|
||||
var bob = servers.pluck(1);
|
||||
var browsers = clients.excluding(servers);
|
||||
var relays = clients.filter('Node.js');
|
||||
var bob = relays.pluck(1);
|
||||
var browsers = clients.excluding(relays);
|
||||
var alice = browsers.pluck(1);
|
||||
var carl = browsers.excluding(alice).pluck(1);
|
||||
var dave = browsers.excluding([alice, carl]).pluck(1);
|
||||
@@ -53,13 +53,13 @@ describe("GET GET", function(){
|
||||
//this.timeout(5 * 60 * 1000);
|
||||
this.timeout(10 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
return servers.atLeast(config.servers);
|
||||
it("Relays have joined!", function(){
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN started!", function(){
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
@@ -70,7 +70,7 @@ describe("GET GET", function(){
|
||||
});
|
||||
var port = env.config.port + env.i;
|
||||
var Gun; try{ Gun = require('gun') }catch(e){ console.log("GUN not found! You need to link GUN to PANIC. Nesting the `gun` repo inside a `node_modules` parent folder often fixes this.") }
|
||||
var peers = [], i = env.config.servers;
|
||||
var peers = [], i = env.config.relays;
|
||||
while(i--){
|
||||
var tmp = (env.config.port + (i + 1));
|
||||
if(port != tmp){ // ignore ourselves
|
||||
@@ -183,7 +183,7 @@ describe("GET GET", function(){
|
||||
|
||||
after("Everything shut down.", function(){
|
||||
require('./util/open').cleanup();
|
||||
return servers.run(function(){
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
servers: 1,
|
||||
relays: 1,
|
||||
browsers: 2,
|
||||
puts: 1000,
|
||||
route: {
|
||||
@@ -29,7 +29,7 @@ var clients = panic.clients;
|
||||
var manager = require('panic-manager')();
|
||||
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){
|
||||
clients: Array(config.relays).fill().map(function(u, i){
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1)
|
||||
@@ -38,9 +38,9 @@ manager.start({
|
||||
panic: 'http://' + config.IP + ':' + config.port
|
||||
});
|
||||
|
||||
var servers = clients.filter('Node.js');
|
||||
var bob = servers.pluck(1);
|
||||
var browsers = clients.excluding(servers);
|
||||
var relays = clients.filter('Node.js');
|
||||
var bob = relays.pluck(1);
|
||||
var browsers = clients.excluding(relays);
|
||||
var alice = browsers.pluck(1);
|
||||
var carl = browsers.excluding(alice).pluck(1);
|
||||
|
||||
@@ -49,13 +49,13 @@ describe("Put ACK", function(){
|
||||
//this.timeout(5 * 60 * 1000);
|
||||
this.timeout(10 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
return servers.atLeast(config.servers);
|
||||
it("Relays have joined!", function(){
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN started!", function(){
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
@@ -66,7 +66,7 @@ describe("Put ACK", function(){
|
||||
});
|
||||
var port = env.config.port + env.i;
|
||||
var Gun; try{ Gun = require('gun') }catch(e){ console.log("GUN not found! You need to link GUN to PANIC. Nesting the `gun` repo inside a `node_modules` parent folder often fixes this.") }
|
||||
var peers = [], i = env.config.servers;
|
||||
var peers = [], i = env.config.relays;
|
||||
while(i--){
|
||||
var tmp = (env.config.port + (i + 1));
|
||||
if(port != tmp){ // ignore ourselves
|
||||
@@ -136,7 +136,7 @@ describe("Put ACK", function(){
|
||||
|
||||
after("Everything shut down.", function(){
|
||||
require('./util/open').cleanup();
|
||||
return servers.run(function(){
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
servers: 1
|
||||
relays: 1
|
||||
}
|
||||
|
||||
var panic; try{ panic = require('panic-server') } catch(e){ console.log("PANIC not installed! `npm install panic-server panic-manager panic-client`") }
|
||||
@@ -20,7 +20,7 @@ var clients = panic.clients;
|
||||
var manager = require('panic-manager')();
|
||||
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){
|
||||
clients: Array(config.relays).fill().map(function(u, i){
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1)
|
||||
@@ -29,21 +29,21 @@ manager.start({
|
||||
panic: 'http://' + config.IP + ':' + config.port
|
||||
});
|
||||
|
||||
var servers = clients.filter('Node.js');
|
||||
var alice = servers.pluck(1);
|
||||
var relays = clients.filter('Node.js');
|
||||
var alice = relays.pluck(1);
|
||||
|
||||
// continue boiler plate, tweak a few defaults if needed, but give descriptive test names...
|
||||
describe("Do not connect to self", function(){
|
||||
//this.timeout(5 * 60 * 1000);
|
||||
this.timeout(10 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
return servers.atLeast(config.servers);
|
||||
it("Relays have joined!", function(){
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN started!", function(){
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
@@ -54,7 +54,7 @@ describe("Do not connect to self", function(){
|
||||
});
|
||||
var port = env.config.port + env.i;
|
||||
var Gun; try{ Gun = require('gun') }catch(e){ console.log("GUN not found! You need to link GUN to PANIC. Nesting the `gun` repo inside a `node_modules` parent folder often fixes this.") }
|
||||
var peers = [], i = env.config.servers;
|
||||
var peers = [], i = env.config.relays;
|
||||
global.self_url = 'http://'+ env.config.IP + ':' + port + '/gun';
|
||||
// make sure to connect to self/same.
|
||||
peers.push(self_url);
|
||||
@@ -72,7 +72,7 @@ describe("Do not connect to self", function(){
|
||||
|
||||
it("Drop self", function(){
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
@@ -103,7 +103,7 @@ describe("Do not connect to self", function(){
|
||||
|
||||
after("Everything shut down.", function(){
|
||||
require('../util/open').cleanup();
|
||||
return servers.run(function(){
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
servers: 3,
|
||||
relays: 3,
|
||||
route: {
|
||||
'/': __dirname + '/index.html',
|
||||
'/gun.js': __dirname + '/../../gun.js',
|
||||
@@ -25,7 +25,7 @@ var clients = panic.clients;
|
||||
var manager = require('panic-manager')();
|
||||
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){
|
||||
clients: Array(config.relays).fill().map(function(u, i){
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1)
|
||||
@@ -34,20 +34,20 @@ manager.start({
|
||||
panic: 'http://' + config.IP + ':' + config.port
|
||||
});
|
||||
|
||||
var servers = clients.filter('Node.js');
|
||||
var relays = clients.filter('Node.js');
|
||||
|
||||
// continue boiler plate, tweak a few defaults if needed, but give descriptive test names...
|
||||
describe("Put ACK", function(){
|
||||
//this.timeout(5 * 60 * 1000);
|
||||
this.timeout(10 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
return servers.atLeast(config.servers);
|
||||
it("Relays have joined!", function(){
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN started!", function(){
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
@@ -58,7 +58,7 @@ describe("Put ACK", function(){
|
||||
});
|
||||
var port = env.config.port + env.i;
|
||||
var Gun; try{ Gun = require('gun') }catch(e){ console.log("GUN not found! You need to link GUN to PANIC. Nesting the `gun` repo inside a `node_modules` parent folder often fixes this.") }
|
||||
var peers = [], i = env.config.servers;
|
||||
var peers = [], i = env.config.relays;
|
||||
while(i--){ // make sure to connect to self/same.
|
||||
var tmp = (env.config.port + (i + 1));
|
||||
peers.push('http://'+ env.config.IP + ':' + tmp + '/gun');
|
||||
@@ -78,7 +78,7 @@ describe("Put ACK", function(){
|
||||
|
||||
it("Drop duplicates", function(){
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
@@ -114,7 +114,7 @@ describe("Put ACK", function(){
|
||||
|
||||
after("Everything shut down.", function(){
|
||||
require('../util/open').cleanup();
|
||||
return servers.run(function(){
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
216
test/panic/axe/3get_dedup.js
Normal file
216
test/panic/axe/3get_dedup.js
Normal file
@@ -0,0 +1,216 @@
|
||||
/*
|
||||
Assume we have 6 peers in a star topology,
|
||||
|
||||
..______r1______..
|
||||
./.../..|...\...\.
|
||||
b1..b2..b3..b4..b5
|
||||
|
||||
Alice, Bob, Carl, Dave, Ed using 1 relay. Alice joins later, asks for data all the others are subscribed to. The GET should be load balanced to ?3? other peers at a time. If ack hashes are not the same, keep asking. If they do match, stop asking other peers - this test checks that.
|
||||
*/
|
||||
|
||||
// <-- PANIC template, copy & paste, tweak a few settings if needed...
|
||||
var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
relays: 1,
|
||||
browsers: 5,
|
||||
route: {
|
||||
'/': __dirname + '/../index.html',
|
||||
'/gun.js': __dirname + '/../../../gun.js',
|
||||
'/jquery.js': __dirname + '/../../../examples/jquery.js'
|
||||
}
|
||||
}
|
||||
|
||||
var panic; try{ panic = require('panic-server') } catch(e){ console.log("PANIC not installed! `npm install panic-server panic-manager panic-client`") }
|
||||
|
||||
panic.server().on('request', function(req, res){
|
||||
config.route[req.url] && require('fs').createReadStream(config.route[req.url]).pipe(res);
|
||||
}).listen(config.port);
|
||||
|
||||
var clients = panic.clients;
|
||||
var manager = require('panic-manager')();
|
||||
|
||||
manager.start({
|
||||
clients: Array(config.relays).fill().map(function(u, i){
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1)
|
||||
}
|
||||
}),
|
||||
panic: 'http://' + config.IP + ':' + config.port
|
||||
});
|
||||
|
||||
var relays = clients.filter('Node.js');
|
||||
var r1 = relays.pluck(1);
|
||||
|
||||
var browsers = clients.excluding(relays);
|
||||
var b1 = browsers.pluck(1);
|
||||
var b2 = relays.excluding(b1).pluck(1);
|
||||
var b3 = relays.excluding([b1,b2]).pluck(1);
|
||||
var b4 = relays.excluding([b1,b2]).pluck(1);
|
||||
var b5 = relays.excluding([b1,b2]).pluck(1);
|
||||
|
||||
// continue boiler plate, tweak a few defaults if needed, but give descriptive test names...
|
||||
describe("Dedup load balancing GETs", function(){
|
||||
//this.timeout(5 * 60 * 1000);
|
||||
this.timeout(10 * 60 * 1000);
|
||||
|
||||
it("Relays have joined!", function(){
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN started!", function(){
|
||||
var tests = [], i = 0;
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
try{ require('fs').unlinkSync(env.i+'data') }catch(e){}
|
||||
try{ require('gun/lib/fsrm')(env.i+'data') }catch(e){}
|
||||
var server = require('http').createServer(function(req, res){
|
||||
res.end("I am "+ env.i +"!");
|
||||
});
|
||||
var port = env.config.port + env.i;
|
||||
var Gun; try{ Gun = require('gun') }catch(e){ console.log("GUN not found! You need to link GUN to PANIC. Nesting the `gun` repo inside a `node_modules` parent folder often fixes this.") }
|
||||
var peers = [], i = env.config.relays;
|
||||
while(i--){ // make sure to connect to self/same.
|
||||
var tmp = (env.config.port + (i + 1));
|
||||
peers.push('http://'+ env.config.IP + ':' + tmp + '/gun');
|
||||
}
|
||||
var gun = Gun({file: env.i+'data', peers: peers, web: server});
|
||||
server.listen(port, function(){
|
||||
test.done();
|
||||
});
|
||||
}, {i: i += 1, config: config}));
|
||||
});
|
||||
return Promise.all(tests);
|
||||
});
|
||||
|
||||
it(config.browsers +" browser(s) have joined!", function(){
|
||||
require('../util/open').web(config.browsers, "http://"+ config.IP +":"+ config.port);
|
||||
return browsers.atLeast(config.browsers);
|
||||
});
|
||||
// end PANIC template -->
|
||||
|
||||
it("Browsers initialized gun!", function(){
|
||||
var tests = [], i = 0;
|
||||
browsers.each(function(browser, id){
|
||||
tests.push(browser.run(function(test){
|
||||
try{ localStorage.clear() }catch(e){}
|
||||
try{ indexedDB.deleteDatabase('radata') }catch(e){}
|
||||
|
||||
// start with the first peer:
|
||||
var env = test.props;
|
||||
var gun = Gun('http://'+ env.config.IP + ':' + (env.config.port + 1) + '/gun');
|
||||
|
||||
window.gun = gun;
|
||||
window.ref = gun.get('test');
|
||||
window.ID = test.props.i;
|
||||
|
||||
if(window.ID === 1){ return } // everyone BUT NOT alice yet.
|
||||
test.async();
|
||||
|
||||
gun.get('test').on(function(data){
|
||||
if(window.C){ return } window.C = 1;
|
||||
setTimeout(function(){
|
||||
var dam = ref.back('opt.mesh');
|
||||
var hear = dam.hear;
|
||||
dam.hear = function(raw, peer){
|
||||
//console.log(window.ID, "HEARD:", raw);
|
||||
window.HEARD = 1;
|
||||
hear(raw, peer);
|
||||
}
|
||||
}, 1000);
|
||||
test.done();
|
||||
})
|
||||
if(window.ID == 2){
|
||||
setTimeout(function(){ gun.get('test').put({hello: 'world'}) },1000);
|
||||
}
|
||||
}, {i: i += 1, config: config}));
|
||||
});
|
||||
return Promise.all(tests);
|
||||
});
|
||||
|
||||
it("wait...", function(done){
|
||||
setTimeout(function(){
|
||||
done();
|
||||
},2000);
|
||||
});
|
||||
|
||||
it("Carl already has the data.", function(){
|
||||
return b3.run(function(test){
|
||||
test.async();
|
||||
if('world' === gun._.graph.test.hello){ // TODO: BAD! Tests should probably not use non-API ways to check things. But whatever, hacky for now.
|
||||
test.done();
|
||||
}
|
||||
}, {acks: config.relays});
|
||||
});
|
||||
|
||||
it("Alice does not have the data, needs to ask for it.", function(){
|
||||
return b1.run(function(test){
|
||||
if(window.ID !== 1){
|
||||
console.log("FAIL: Alice not match ID");
|
||||
alice_mismatch;
|
||||
}
|
||||
if(gun._.graph.test){ // TODO: BAD! Tests should probably not use non-API ways to check things. But whatever, hacky for now.
|
||||
console.log("FAIL: Alice got synced data she was not subscribed to. This may mean a more basic feature (pub/sub) of AXE is broken.");
|
||||
alice_already_had_the_data;
|
||||
}
|
||||
test.async();
|
||||
|
||||
ref.once(function(data){
|
||||
if('world' === data.hello){
|
||||
test.done();
|
||||
}
|
||||
})
|
||||
}, {acks: config.relays});
|
||||
});
|
||||
|
||||
it("How many heard?", function(){ // This test is a little weird...
|
||||
this.timeout(2000);
|
||||
var heard = 0, missed = 0;
|
||||
var tests = [], i = 0;
|
||||
browsers.each(function(browser, id){
|
||||
tests.push(browser.run(function(test){
|
||||
//console.log(window.ID, 'heard?', window.HEARD);
|
||||
test.async();
|
||||
if(window.HEARD){
|
||||
test.done();
|
||||
} else {
|
||||
throw new Error("DID NOT HEAR");
|
||||
}
|
||||
}, {i: i += 1, config: config}).then(function(){
|
||||
console.log(id.slice(0,2), "was asked");
|
||||
heard += 1;
|
||||
}).catch(function(err){
|
||||
if(0 <= err.message.indexOf('NOT HEAR')){
|
||||
console.log(id.slice(0,2), "was NOT asked.");
|
||||
missed += 1;
|
||||
return;
|
||||
}
|
||||
throw new Error("other error");
|
||||
}));
|
||||
});
|
||||
return Promise.all(tests).then(function(){
|
||||
console.log("COMPARE?", heard, missed);
|
||||
if(missed >= 2 && heard <= 3){ return }
|
||||
console.log("ERROR! Note: This test was hardcoded to 3 AXE turns. If turns are dynamic or different or variable now, you need to update this test.")
|
||||
throw new Error("GET was heard by too many peers!");
|
||||
})
|
||||
});
|
||||
|
||||
it("All finished!", function(done){
|
||||
console.log("Done! Cleaning things up...");
|
||||
setTimeout(function(){
|
||||
done();
|
||||
},1000);
|
||||
});
|
||||
|
||||
after("Everything shut down.", function(){
|
||||
require('../util/open').cleanup();
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -13,12 +13,12 @@ But then 300K peers connect to the 1st one.
|
||||
We want to then see the peers move to the other relays, such that the 3 have 100K peers each.
|
||||
|
||||
(1) To simulate this, we will have 3 peers connect starting like this:
|
||||
..s1-----s2--s3
|
||||
..r1-----r2--r3
|
||||
./\.\..........
|
||||
b1.b2.b3.......
|
||||
|
||||
(2) By the end of the test, the "mob" logic should rebalance the load to look like this:
|
||||
..s1--s2--s3..
|
||||
..r1--r2--r3..
|
||||
./....|.....\.
|
||||
b1....b2....b3
|
||||
|
||||
@@ -32,7 +32,7 @@ var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
servers: 3,
|
||||
relays: 3,
|
||||
browsers: 3,
|
||||
route: {
|
||||
'/': __dirname + '/../index.html',
|
||||
@@ -51,7 +51,7 @@ var clients = panic.clients;
|
||||
var manager = require('panic-manager')();
|
||||
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){
|
||||
clients: Array(config.relays).fill().map(function(u, i){
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1)
|
||||
@@ -60,39 +60,39 @@ manager.start({
|
||||
panic: 'http://' + config.IP + ':' + config.port
|
||||
});
|
||||
|
||||
var servers = clients.filter('Node.js');
|
||||
var s1 = servers.pluck(1);
|
||||
var s2 = servers.excluding(s1).pluck(1);
|
||||
var s3 = servers.excluding([s1,s2]).pluck(1);
|
||||
var relays = clients.filter('Node.js');
|
||||
var r1 = relays.pluck(1);
|
||||
var r2 = relays.excluding(r1).pluck(1);
|
||||
var r3 = relays.excluding([r1,r2]).pluck(1);
|
||||
|
||||
var browsers = clients.excluding(servers);
|
||||
var browsers = clients.excluding(relays);
|
||||
var b1 = browsers.pluck(1);
|
||||
var b2 = servers.excluding(b1).pluck(1);
|
||||
var b3 = servers.excluding([b1,b2]).pluck(1);
|
||||
var b2 = relays.excluding(b1).pluck(1);
|
||||
var b3 = relays.excluding([b1,b2]).pluck(1);
|
||||
|
||||
// continue boiler plate, tweak a few defaults if needed, but give descriptive test names...
|
||||
describe("Put ACK", function(){
|
||||
describe("Mob test.", function(){
|
||||
//this.timeout(5 * 60 * 1000);
|
||||
this.timeout(10 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
return servers.atLeast(config.servers);
|
||||
it("Relays have joined!", function(){
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN started!", function(){
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
tests.push(client.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
try{ require('fs').unlinkSync(env.i+'data') }catch(e){}
|
||||
try{ require('gun/lib/fsrm')(env.i+'data') }catch(e){}
|
||||
try{ require('gun/lib/fsrm')(env.i+'data') }catch(e){}
|
||||
var server = require('http').createServer(function(req, res){
|
||||
res.end("I am "+ env.i +"!");
|
||||
});
|
||||
var port = env.config.port + env.i;
|
||||
var Gun; try{ Gun = require('gun') }catch(e){ console.log("GUN not found! You need to link GUN to PANIC. Nesting the `gun` repo inside a `node_modules` parent folder often fixes this.") }
|
||||
var peers = [], i = env.config.servers;
|
||||
var peers = [], i = env.config.relays;
|
||||
while(i--){ // make sure to connect to self/same.
|
||||
var tmp = (env.config.port + (i + 1));
|
||||
peers.push('http://'+ env.config.IP + ':' + tmp + '/gun');
|
||||
@@ -100,9 +100,7 @@ describe("Put ACK", function(){
|
||||
console.log(port, " connect to ", peers);
|
||||
var gun = Gun({file: env.i+'data', peers: peers, web: server, mob: 3, multicast: false});
|
||||
global.gun = gun;
|
||||
Object.port = port;
|
||||
server.listen(port, function(){
|
||||
console.log(port, 'DONE');
|
||||
test.done();
|
||||
});
|
||||
|
||||
@@ -125,7 +123,6 @@ describe("Put ACK", function(){
|
||||
test.async();
|
||||
try{ localStorage.clear() }catch(e){}
|
||||
try{ indexedDB.deleteDatabase('radata') }catch(e){}
|
||||
Object.tid = test.props.i;
|
||||
|
||||
// start with the first peer:
|
||||
var env = test.props;
|
||||
@@ -135,11 +132,10 @@ describe("Put ACK", function(){
|
||||
var mesh = gun.back('opt.mesh'); // overload...
|
||||
mesh.hear['mob'] = function(msg, peer){
|
||||
// TODO: NOTE, code AXE DHT to aggressively drop new peers AFTER superpeer sends this rebalance/disconnect message that contains some other superpeers.
|
||||
gun.CHANGED = 1;
|
||||
clearTimeout(gun.TO); gun.TO = setTimeout(end, 2000);
|
||||
console.log(1111, 'Browser', env.i, 'choose', one, 'of', JSON.stringify(msg.peers), 'got from', peer.url);//, 'from', msg.peers+'');
|
||||
if(!msg.peers){ return }
|
||||
var one = msg.peers[Math.floor(Math.random()*msg.peers.length)];
|
||||
console.log('Browser', env.i, 'chooses', one, 'from', JSON.stringify(msg.peers), 'that', peer.url, 'suggested, because it is mobbed.');//, 'from', msg.peers+'');
|
||||
mesh.bye(peer); // Idea: Should keep track of failed ones to reduce repeats. For another feature/module that deserves its own separate test.
|
||||
mesh.hi(one);
|
||||
}
|
||||
@@ -167,8 +163,6 @@ describe("Put ACK", function(){
|
||||
browsers.each(function(browser, id){
|
||||
tests.push(browser.run(function(test){
|
||||
test.async();
|
||||
|
||||
//console.log(2222222, "I don't understand", test.props.i, 'how can I have non URL peers?', ''+Object.keys(gun.back('opt.peers')));
|
||||
ref.get('b'+test.props.i).put(''+Object.keys(gun.back('opt.peers')));
|
||||
// NOTE: Above line was put here as a workaround. Even if this line was in the prior step, this test should still pass. Make sure there is another test that correctly checks for reconnect logic properly restoring sync.
|
||||
|
||||
@@ -176,7 +170,7 @@ describe("Put ACK", function(){
|
||||
if(!data.b1 || !data.b2 || !data.b3){ return }
|
||||
clearTimeout(test.to);
|
||||
test.to = setTimeout(function(){
|
||||
//var d = {...data}; delete d._; console.log(test.props.i, "update:", JSON.stringify(d));
|
||||
var d = {}; Object.keys(data).sort().forEach(function(i){ d[i] = data[i] }); delete d._; console.log(test.props.i, "sees", JSON.stringify(d));
|
||||
var now = Object.keys(gun.back('opt.peers'));
|
||||
if(now.length > 1){
|
||||
console.log("FAIL: too_many_connections");
|
||||
@@ -216,7 +210,7 @@ describe("Put ACK", function(){
|
||||
|
||||
after("Everything shut down.", function(){
|
||||
require('../util/open').cleanup();
|
||||
return servers.run(function(){
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
@@ -20,7 +20,7 @@ var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
servers: 1,
|
||||
relays: 1,
|
||||
browsers: 2, //3,
|
||||
each: 100000,
|
||||
size: 1,
|
||||
@@ -42,40 +42,40 @@ panic.server().on('request', function(req, res){ // Static server
|
||||
// We need a way to reference all of them.
|
||||
var clients = panic.clients;
|
||||
|
||||
// Some of the clients may be NodeJS servers on different machines.
|
||||
// Some of the clients may be NodeJS relays on different machines.
|
||||
// PANIC manager is a nifty tool that lets us remotely spawn them.
|
||||
var manager = require('panic-manager')();
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){ // Create a bunch of servers.
|
||||
clients: Array(config.relays).fill().map(function(u, i){ // Create a bunch of relays.
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1) // They'll need unique ports to start their servers on, if we run the test on 1 machine.
|
||||
port: config.port + (i + 1) // They'll need unique ports to start on, if we run the test on 1 machine.
|
||||
}
|
||||
}),
|
||||
panic: 'http://' + config.IP + ':' + config.port // Auto-connect to our panic server.
|
||||
});
|
||||
|
||||
// Now lets divide our clients into "servers" and "browsers".
|
||||
var servers = clients.filter('Node.js');
|
||||
var browsers = clients.excluding(servers);
|
||||
// Now lets divide our clients into "relays" and "browsers".
|
||||
var relays = clients.filter('Node.js');
|
||||
var browsers = clients.excluding(relays);
|
||||
var alice = browsers.pluck(1);
|
||||
var carl = browsers.excluding(alice).pluck(1);
|
||||
|
||||
describe("Load test "+ config.browsers +" browser(s) across "+ config.servers +" server(s)!", function(){
|
||||
describe("Load test "+ config.browsers +" browser(s) across "+ config.relays +" server(s)!", function(){
|
||||
|
||||
// We'll have to manually launch the browsers,
|
||||
// So lets up the timeout so we have time to do that.
|
||||
this.timeout(50 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
it("Relays have joined!", function(){
|
||||
// Alright, lets wait until enough gun server peers are connected.
|
||||
return servers.atLeast(config.servers);
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN has spawned!", function(){
|
||||
// Once they are, we need to actually spin up the gun server.
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
// for each server peer, tell it to run this code:
|
||||
tests.push(client.run(function(test){
|
||||
// NOTE: Despite the fact this LOOKS like we're in a closure...
|
||||
@@ -92,7 +92,7 @@ describe("Load test "+ config.browsers +" browser(s) across "+ config.servers +"
|
||||
// Launch the server and start gun!
|
||||
var Gun; try{ Gun = require('gun') }catch(e){ console.log("GUN not found! You need to link GUN to PANIC. Nesting the `gun` repo inside a `node_modules` parent folder often fixes this.") }
|
||||
// Attach the server to gun.
|
||||
var gun = Gun({file: env.i+'data', web: server, axe: false, localStorage: false, radisk: false});
|
||||
var gun = Gun({file: env.i+'data', web: server, localStorage: false, radisk: false});
|
||||
server.listen(env.config.port + env.i, function(){
|
||||
// This server peer is now done with the test!
|
||||
// It has successfully launched.
|
||||
@@ -196,8 +196,8 @@ describe("Load test "+ config.browsers +" browser(s) across "+ config.servers +"
|
||||
location.reload();
|
||||
}, 15 * 1000);
|
||||
});
|
||||
// And shut down all the servers.
|
||||
return servers.run(function(){
|
||||
// And shut down all the relays.
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ var ip; try{ ip = require('ip').address() }catch(e){}
|
||||
var config = {
|
||||
IP: ip || 'localhost',
|
||||
port: 8765,
|
||||
servers: 2,
|
||||
relays: 2,
|
||||
browsers: 2,
|
||||
route: {
|
||||
'/': __dirname + '/index.html',
|
||||
@@ -22,7 +22,7 @@ var clients = panic.clients;
|
||||
var manager = require('panic-manager')();
|
||||
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){
|
||||
clients: Array(config.relays).fill().map(function(u, i){
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1)
|
||||
@@ -31,10 +31,10 @@ manager.start({
|
||||
panic: 'http://' + config.IP + ':' + config.port
|
||||
});
|
||||
|
||||
var servers = clients.filter('Node.js');
|
||||
var server = servers.pluck(1);
|
||||
var spawn = servers.excluding(server).pluck(1);
|
||||
var browsers = clients.excluding(servers);
|
||||
var relays = clients.filter('Node.js');
|
||||
var relay = relays.pluck(1);
|
||||
var spawn = relays.excluding(relay).pluck(1);
|
||||
var browsers = clients.excluding(relays);
|
||||
var alice = browsers.pluck(1);
|
||||
var bob = browsers.excluding(alice).pluck(1);
|
||||
var again = {};
|
||||
@@ -44,12 +44,12 @@ describe("The Holy Grail Test!", function(){
|
||||
//this.timeout(5 * 60 * 1000);
|
||||
this.timeout(10 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
return servers.atLeast(config.servers);
|
||||
it("relays have joined!", function(){
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN started!", function(){
|
||||
return server.run(function(test){
|
||||
return relay.run(function(test){
|
||||
var env = test.props;
|
||||
test.async();
|
||||
try{ require('fs').unlinkSync(env.i+'data') }catch(e){}
|
||||
@@ -111,8 +111,8 @@ describe("The Holy Grail Test!", function(){
|
||||
})
|
||||
});
|
||||
|
||||
it("Server has crashed and been wiped!", function(){
|
||||
return server.run(function(test){
|
||||
it("Relay has crashed and been wiped!", function(){
|
||||
return relay.run(function(test){
|
||||
console.log(3);
|
||||
var env = test.props;
|
||||
try{ require('fs').unlinkSync(env.i+'data') }catch(e){}
|
||||
@@ -133,7 +133,7 @@ describe("The Holy Grail Test!", function(){
|
||||
var err;
|
||||
try{ new WebSocket('http://'+ env.config.IP + ':' + (env.config.port + 2) + '/gun') }catch(e){ err = e }
|
||||
if(!err){
|
||||
test.fail("Server did not crash.");
|
||||
test.fail("Relay did not crash.");
|
||||
}
|
||||
}
|
||||
ref.put("Alice");
|
||||
@@ -148,7 +148,7 @@ describe("The Holy Grail Test!", function(){
|
||||
var err;
|
||||
try{ new WebSocket('http://'+ env.config.IP + ':' + (env.config.port + 2) + '/gun') }catch(e){ err = e }
|
||||
if(!err){
|
||||
test.fail("Server did not crash.");
|
||||
test.fail("Relay did not crash.");
|
||||
}
|
||||
}
|
||||
ref.put("Bob");
|
||||
@@ -282,7 +282,7 @@ describe("The Holy Grail Test!", function(){
|
||||
|
||||
after("Everything shut down.", function(){
|
||||
require('./util/open').cleanup();
|
||||
return servers.run(function(){
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
var config = {
|
||||
IP: require('ip').address(),
|
||||
port: 8765,
|
||||
servers: 1,
|
||||
relays: 1,
|
||||
browsers: 4,
|
||||
each: 1500,
|
||||
wait: 1,
|
||||
@@ -37,42 +37,42 @@ panic.server().on('request', function(req, res){ // Static server
|
||||
// We need a way to reference all of them.
|
||||
var clients = panic.clients;
|
||||
|
||||
// Some of the clients may be NodeJS servers on different machines.
|
||||
// Some of the clients may be NodeJS relays on different machines.
|
||||
// PANIC manager is a nifty tool that lets us remotely spawn them.
|
||||
var manager = require('panic-manager')();
|
||||
manager.start({
|
||||
clients: Array(config.servers).fill().map(function(u, i){ // Create a bunch of servers.
|
||||
clients: Array(config.relays).fill().map(function(u, i){ // Create a bunch of relays.
|
||||
return {
|
||||
type: 'node',
|
||||
port: config.port + (i + 1) // They'll need unique ports to start their servers on, if we run the test on 1 machine.
|
||||
port: config.port + (i + 1) // They'll need unique ports to start on, if we run the test on 1 machine.
|
||||
}
|
||||
}),
|
||||
panic: 'http://' + config.IP + ':' + config.port // Auto-connect to our panic server.
|
||||
});
|
||||
|
||||
// Now lets divide our clients into "servers" and "browsers".
|
||||
var servers = clients.filter('Node.js');
|
||||
var browsers = clients.excluding(servers);
|
||||
// Now lets divide our PANIC clients into "relays" and "browsers".
|
||||
var relays = clients.filter('Node.js');
|
||||
var browsers = clients.excluding(relays);
|
||||
|
||||
// Sweet! Now we can start the tests.
|
||||
// PANIC works with Mocha and other testing libraries!
|
||||
// So it is easy to use PANIC.
|
||||
|
||||
describe("Load test "+ config.browsers +" browser(s) across "+ config.servers +" server(s)!", function(){
|
||||
describe("Load test "+ config.browsers +" browser(s) across "+ config.relays +" server(s)!", function(){
|
||||
|
||||
// We'll have to manually launch the browsers,
|
||||
// So lets up the timeout so we have time to do that.
|
||||
this.timeout(5 * 60 * 1000);
|
||||
|
||||
it("Servers have joined!", function(){
|
||||
it("Relays have joined!", function(){
|
||||
// Alright, lets wait until enough gun server peers are connected.
|
||||
return servers.atLeast(config.servers);
|
||||
return relays.atLeast(config.relays);
|
||||
});
|
||||
|
||||
it("GUN has spawned!", function(){
|
||||
// Once they are, we need to actually spin up the gun server.
|
||||
var tests = [], i = 0;
|
||||
servers.each(function(client){
|
||||
relays.each(function(client){
|
||||
// for each server peer, tell it to run this code:
|
||||
tests.push(client.run(function(test){
|
||||
// NOTE: Despite the fact this LOOKS like we're in a closure...
|
||||
@@ -109,7 +109,7 @@ describe("Load test "+ config.browsers +" browser(s) across "+ config.servers +"
|
||||
require('./util/open').web(config.browsers, "http://"+ config.IP +":"+ config.port);
|
||||
// Which is to automatically or manually open up a bunch of browser tabs
|
||||
// and connect to the PANIC server in the same way
|
||||
// the NodeJS servers did.
|
||||
// the NodeJS relays did.
|
||||
|
||||
// However! We're gonna cheat...
|
||||
browsers.atLeast(1).then(function(){
|
||||
@@ -161,13 +161,13 @@ describe("Load test "+ config.browsers +" browser(s) across "+ config.servers +"
|
||||
// as well as other configuration information.
|
||||
test.async();
|
||||
// Now we want to connect to every gun server peer...
|
||||
var peers = [], i = env.config.servers;
|
||||
var peers = [], i = env.config.relays;
|
||||
while(i--){
|
||||
// For the total number of servers listed in the configuration
|
||||
// For the total number of relays listed in the configuration
|
||||
// Add their URL into an array.
|
||||
peers.push('http://'+ env.config.IP + ':' + (env.config.port + (i + 1)) + '/gun');
|
||||
}
|
||||
// Pass all the servers we want to connect to into gun.
|
||||
// Pass all the relays we want to connect to into gun.
|
||||
//var gun = Gun();
|
||||
var gun = Gun(peers);
|
||||
// Now we want to create a list
|
||||
@@ -255,8 +255,8 @@ describe("Load test "+ config.browsers +" browser(s) across "+ config.servers +"
|
||||
location.reload();
|
||||
}, 15 * 1000);
|
||||
});
|
||||
// And shut down all the servers.
|
||||
return servers.run(function(){
|
||||
// And shut down all the relays.
|
||||
return relays.run(function(){
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user