From 45c1dda39dde062b3d424f8b27d0d0eab55488cc Mon Sep 17 00:00:00 2001 From: Juhyung Park Date: Thu, 6 Aug 2020 16:18:22 +0900 Subject: [PATCH] Make sync tests not to propagate transactions These tests use solo consensus. To generate a block with the solo consensus, there should be a transaction. These tests send a transaction to a node to make a block. Then the node propagates the generated block to other nodes. These tests then check the other nodes whether the received the block or not. However, if the transaction is propagated before the block, these tests fail. If the transaction is propagated, other nodes will generate their own blocks. Then they will reject the block that the first node generated. --- test/src/e2e.long/sync2.test.ts | 6 ++++-- test/src/e2e.long/sync3.test.ts | 4 +++- test/src/e2e.long/sync5.test.ts | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/test/src/e2e.long/sync2.test.ts b/test/src/e2e.long/sync2.test.ts index f63f821e25..93e8ae0834 100644 --- a/test/src/e2e.long/sync2.test.ts +++ b/test/src/e2e.long/sync2.test.ts @@ -25,8 +25,10 @@ describe("sync 2 nodes", function() { describe("2 nodes", function() { beforeEach(async function() { - nodeA = new CodeChain(); - nodeB = new CodeChain(); + // To generate a block this test sends a tx to a node. + // If the tx is propagated before generating a block, tests in this file would fail. + nodeA = new CodeChain({ argv: ["--no-tx-relay"] }); + nodeB = new CodeChain({ argv: ["--no-tx-relay"] }); await Promise.all([nodeA.start(), nodeB.start()]); }); diff --git a/test/src/e2e.long/sync3.test.ts b/test/src/e2e.long/sync3.test.ts index ab724ad702..12ac312a89 100644 --- a/test/src/e2e.long/sync3.test.ts +++ b/test/src/e2e.long/sync3.test.ts @@ -28,7 +28,9 @@ describe("sync 3 nodes", function() { nodes = []; for (let i = 0; i < NUM_NODES; i++) { const node = new CodeChain({ - argv: ["--no-discovery"] + // To generate a block this test sends a tx to a node. + // If the tx is propagated before generating a block, tests in this file would fail. + argv: ["--no-discovery", "--no-tx-relay"] }); nodes.push(node); } diff --git a/test/src/e2e.long/sync5.test.ts b/test/src/e2e.long/sync5.test.ts index 32f02aa903..b905925372 100644 --- a/test/src/e2e.long/sync5.test.ts +++ b/test/src/e2e.long/sync5.test.ts @@ -27,8 +27,10 @@ describe("sync 5 nodes", function() { nodes = []; for (let i = 0; i < NUM_NODES; i++) { + // To generate a block this test sends a tx to a node. + // If the tx is propagated before generating a block, tests in this file would fail. const node = new CodeChain({ - argv: ["--no-discovery"] + argv: ["--no-discovery", "--no-tx-relay"] }); nodes.push(node); }