Skip to content

Commit

Permalink
#4418: fixing issues with scenarios in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sreuland committed Jun 3, 2022
1 parent 06f2759 commit 344355a
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 22 deletions.
5 changes: 5 additions & 0 deletions services/horizon/internal/db2/history/fee_bump_scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,17 @@ func FeeBumpScenario(tt *test.T, q *Q, successful bool) FeeBumpFixture {
})
ctx := context.Background()
insertBuilder := q.NewTransactionBatchInsertBuilder(2)
prefilterInsertBuilder := q.NewTransactionFilteredTmpBatchInsertBuilder(2)
// include both fee bump and normal transaction in the same batch
// to make sure both kinds of transactions can be inserted using a single exec statement
tt.Assert.NoError(insertBuilder.Add(ctx, feeBumpTransaction, sequence))
tt.Assert.NoError(insertBuilder.Add(ctx, normalTransaction, sequence))
tt.Assert.NoError(insertBuilder.Exec(ctx))

tt.Assert.NoError(prefilterInsertBuilder.Add(ctx, feeBumpTransaction, sequence))
tt.Assert.NoError(prefilterInsertBuilder.Add(ctx, normalTransaction, sequence))
tt.Assert.NoError(prefilterInsertBuilder.Exec(ctx))

account := fixture.Envelope.SourceAccount().ToAccountId()
feeBumpAccount := fixture.Envelope.FeeBumpAccount().ToAccountId()

Expand Down
6 changes: 3 additions & 3 deletions services/horizon/internal/db2/schema/bindata.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions services/horizon/internal/test/scenarios/base-horizon.sql
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,8 @@ INSERT INTO gorp_migrations VALUES ('52_add_trade_type_index.sql', '2021-12-02 0
INSERT INTO gorp_migrations VALUES ('53_add_trades_rounding_slippage.sql', '2021-12-02 01:33:33.47903+00');
INSERT INTO gorp_migrations VALUES ('54_tx_preconditions_and_account_fields.sql', '2021-12-02 01:33:33.47903+00');
INSERT INTO gorp_migrations VALUES ('55_filter_rules.sql', '2022-01-02 01:33:33.47903+00');
INSERT INTO gorp_migrations VALUES ('56_trade_aggregation_autovac.sql', '2022-01-02 01:33:33.47903+00');
INSERT INTO gorp_migrations VALUES ('57_txsub_read_only.sql', '2022-01-02 01:33:33.47903+00');


--
Expand Down Expand Up @@ -1563,13 +1565,6 @@ CREATE TABLE asset_filter_rules (
INSERT INTO account_filter_rules VALUES (false, '{}', 0);
INSERT INTO asset_filter_rules VALUES (false, '{}', 0);

CREATE TABLE txsub_results (
transaction_hash varchar(64) NOT NULL UNIQUE,
inner_transaction_hash varchar(64),
tx_result text, -- serialized history.Transaction
submitted_at timestamp NOT NULL DEFAULT NOW()
);

-- migration 57

CREATE TABLE history_transactions_filtered_tmp AS
Expand Down
12 changes: 6 additions & 6 deletions services/horizon/internal/test/scenarios/bindata.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ INSERT INTO gorp_migrations VALUES ('46_add_muxed_accounts.sql', '2019-10-31 14:
INSERT INTO gorp_migrations VALUES ('53_add_trades_rounding_slippage.sql', '2019-10-31 14:19:49.123835+01');
INSERT INTO gorp_migrations VALUES ('54_tx_preconditions_and_account_fields.sql', '2019-10-31 14:19:49.123835+01');
INSERT INTO gorp_migrations VALUES ('55_filter_rules.sql', '2019-10-31 14:19:49.123835+01');
INSERT INTO gorp_migrations VALUES ('56_trade_aggregation_autovac.sql', '2022-01-02 01:33:33.47903+00');
INSERT INTO gorp_migrations VALUES ('57_txsub_read_only.sql', '2022-01-02 01:33:33.47903+00');

--
-- Data for Name: history_accounts; Type: TABLE DATA; Schema: public; Owner: -
Expand Down Expand Up @@ -1090,12 +1092,7 @@ ALTER TABLE accounts_signers
ALTER COLUMN signer TYPE text;

-- migration 55
CREATE TABLE txsub_results (
transaction_hash varchar(64) NOT NULL UNIQUE,
inner_transaction_hash varchar(64),
tx_result text, -- serialized history.Transaction
submitted_at timestamp NOT NULL DEFAULT NOW()
);

CREATE TABLE account_filter_rules (
enabled bool NOT NULL default false,
whitelist varchar[] NOT NULL,
Expand Down

0 comments on commit 344355a

Please sign in to comment.