Browse Source

debug travis issue

activeAddress
Gregg Zigler 10 years ago
parent
commit
a04962cdb7
  1. 20
      test/integration/server.js

20
test/integration/server.js

@ -1770,13 +1770,17 @@ describe('Wallet service', function() {
}); });
it('should follow backoff time after consecutive rejections', function(done) { it('should follow backoff time after consecutive rejections', function(done) {
this.timeout(10000); // find out why travis is timing out function logTime(i, j) {
console.log('createTx backoff ' + i + ' ' + j + ' ' + (Date.now()));
};
async.series([ async.series([
function(next) { function(next) {
async.each(_.range(3), function(i, next) { async.each(_.range(3), function(i, next) {
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0);
logTime('' + (i + 1), 'a');
server.createTx(txOpts, function(err, tx) { server.createTx(txOpts, function(err, tx) {
logTime('' + (i + 1), 'b');
should.not.exist(err); should.not.exist(err);
server.rejectTx({ server.rejectTx({
txProposalId: tx.id, txProposalId: tx.id,
@ -1789,7 +1793,9 @@ describe('Wallet service', function() {
function(next) { function(next) {
// Allow a 4th tx // Allow a 4th tx
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0);
logTime('4', 'a');
server.createTx(txOpts, function(err, tx) { server.createTx(txOpts, function(err, tx) {
logTime('4', 'b');
server.rejectTx({ server.rejectTx({
txProposalId: tx.id, txProposalId: tx.id,
reason: 'some reason', reason: 'some reason',
@ -1799,17 +1805,24 @@ describe('Wallet service', function() {
function(next) { function(next) {
// Do not allow before backoff time // Do not allow before backoff time
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0);
logTime('5a', 'b');
server.createTx(txOpts, function(err, tx) { server.createTx(txOpts, function(err, tx) {
logTime('5a', 'b');
should.exist(err); should.exist(err);
err.code.should.equal('NOTALLOWEDTOCREATETX'); err.code.should.equal('NOTALLOWEDTOCREATETX');
next(); next();
}); });
}, },
function(next) { function(next) {
logTime('5', 'a');
var clock = sinon.useFakeTimers(Date.now() + (WalletService.backoffTimeMinutes + 2) * 60 * 1000); var clock = sinon.useFakeTimers(Date.now() + (WalletService.backoffTimeMinutes + 2) * 60 * 1000);
logTime('5', 'b');
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0);
logTime('5', 'c');
server.createTx(txOpts, function(err, tx) { server.createTx(txOpts, function(err, tx) {
logTime('5', 'd');
clock.restore(); clock.restore();
logTime('5', 'e');
server.rejectTx({ server.rejectTx({
txProposalId: tx.id, txProposalId: tx.id,
reason: 'some reason', reason: 'some reason',
@ -1818,10 +1831,15 @@ describe('Wallet service', function() {
}, },
function(next) { function(next) {
// Do not allow a 5th tx before backoff time // Do not allow a 5th tx before backoff time
logTime('6', 'a');
var clock = sinon.useFakeTimers(Date.now() + (WalletService.backoffTimeMinutes + 2) * 60 * 1000 + 1); var clock = sinon.useFakeTimers(Date.now() + (WalletService.backoffTimeMinutes + 2) * 60 * 1000 + 1);
logTime('6', 'b');
var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0); var txOpts = helpers.createProposalOpts('18PzpUFkFZE8zKWUPvfykkTxmB9oMR8qP7', 1, null, TestData.copayers[0].privKey_1H_0);
logTime('6', 'c');
server.createTx(txOpts, function(err, tx) { server.createTx(txOpts, function(err, tx) {
logTime('6', 'd');
clock.restore(); clock.restore();
logTime('6', 'e');
should.exist(err); should.exist(err);
err.code.should.equal('NOTALLOWEDTOCREATETX'); err.code.should.equal('NOTALLOWEDTOCREATETX');
next(); next();

Loading…
Cancel
Save