From c23be959f855c78fc53c89014b68903030f4ca19 Mon Sep 17 00:00:00 2001 From: Pawel Gebal Date: Fri, 9 Oct 2020 16:08:51 +0200 Subject: [PATCH] refactor: speed up finalizes current forming block and inserts new one if transaction limit for a block is reached test --- apps/engine/test/engine/callbacks/deposit_test.exs | 2 +- apps/engine/test/engine/db/transaction_test.exs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/engine/test/engine/callbacks/deposit_test.exs b/apps/engine/test/engine/callbacks/deposit_test.exs index db5e91d1..171cca14 100644 --- a/apps/engine/test/engine/callbacks/deposit_test.exs +++ b/apps/engine/test/engine/callbacks/deposit_test.exs @@ -1,7 +1,7 @@ defmodule Engine.Callbacks.DepositTest do @moduledoc false - use Engine.DB.DataCase, async: true + use Engine.DB.DataCase, async: false alias Engine.Callbacks.Deposit alias Engine.DB.ListenerState diff --git a/apps/engine/test/engine/db/transaction_test.exs b/apps/engine/test/engine/db/transaction_test.exs index 05456ac5..fd19b3a6 100644 --- a/apps/engine/test/engine/db/transaction_test.exs +++ b/apps/engine/test/engine/db/transaction_test.exs @@ -184,12 +184,11 @@ defmodule Engine.DB.TransactionTest do assert expected_position == actual_positions end - @tag timeout: :infinity - @tag :integration test "finalizes current forming block and inserts new one if transaction limit for a block is reached" do block = insert(:block) - _ = Enum.map(1..@max_txcount, fn index -> insert(:payment_v1_transaction, %{block: block, tx_index: index}) end) + # we determine number of transactions in a block by querying for max transaction index in the block + _ = insert(:payment_v1_transaction, %{block: block, tx_index: @max_txcount}) tx_bytes = transaction_bytes() {:ok, %{transaction: transaction}} = Transaction.insert(tx_bytes)