-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(cucumber): add concurrent wallet daemon call (#1140)
Description --- * Add concurrent wallet daemon call ability to replicate VN cli test functionality * Update concurrent feature with using the wallet daemon * Concurrent feature is disabled due to lock bug while awaiting engine update
- Loading branch information
1 parent
5431162
commit b603394
Showing
5 changed files
with
133 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 28 additions & 23 deletions
51
integration_tests/tests/features/concurrency.feature.ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,51 @@ | ||
# Copyright 2024 The Tari Project | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
|
||
@concurrency | ||
@concurrency @doit | ||
Feature: Concurrency | ||
|
||
@serial | ||
Scenario: Concurrent calls to the Counter template | ||
Given fees are disabled | ||
|
||
##### Setup | ||
# Initialize a base node, wallet, miner and VN | ||
Given fees are disabled | ||
Given a base node BASE | ||
Given a wallet WALLET connected to base node BASE | ||
Given a miner MINER connected to base node BASE and wallet WALLET | ||
|
||
# Initialize a VN | ||
Given a validator node VAL_1 connected to base node BASE and wallet daemon WALLET_D | ||
# Initialize a validator node | ||
Given a validator node VN connected to base node BASE and wallet daemon WALLET_D | ||
|
||
# The wallet must have some funds before the VN sends transactions | ||
When miner MINER mines 6 new blocks | ||
When wallet WALLET has at least 20 T | ||
# Fund wallet to send VN registration tx | ||
When miner MINER mines 10 new blocks | ||
When wallet WALLET has at least 2000 T | ||
When validator node VN sends a registration transaction to base wallet WALLET | ||
When miner MINER mines 16 new blocks | ||
Then the validator node VN is listed as registered | ||
|
||
# VN registration | ||
When validator node VAL_1 sends a registration transaction to base wallet WALLET | ||
# Initialize indexer and connect wallet daemon | ||
Given an indexer IDX connected to base node BASE | ||
Given a wallet daemon WALLET_D connected to indexer IDX | ||
|
||
# Register the "counter" template | ||
When base wallet WALLET registers the template "counter" | ||
When miner MINER mines 13 new blocks | ||
Then VAL_1 has scanned to height 16 | ||
Then the validator node VAL_1 is listed as registered | ||
Then the template "counter" is listed as registered by the validator node VAL_1 | ||
When miner MINER mines 20 new blocks | ||
Then VN has scanned to height 43 | ||
|
||
# A file-base CLI account must be created to sign future calls | ||
When I use an account key named K1 | ||
# Create the sender account | ||
When I create an account ACC via the wallet daemon WALLET_D with 10000 free coins | ||
|
||
# Create a new Counter component | ||
When I create a component COUNTER_1 of template "counter" on VAL_1 using "new" | ||
When I print the cucumber world | ||
##### Scenario | ||
# The initial value of the counter must be 0 | ||
When I call function "new" on template "counter" using account ACC to pay fees via wallet daemon WALLET_D named "COUNTER" | ||
When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "value" the result is "0" | ||
|
||
# Send multiple concurrent transactions to increase the counter | ||
# TODO: when concurrency is fully working, call it with "2 times" or higher | ||
When I invoke on VAL_1 on component COUNTER_1/components/Counter the method call "increase" concurrently 1 times | ||
When I print the cucumber world | ||
# Currently there is a lock bug where the subsequent transactions executed are being rejected, should be tested later after engine changes: | ||
# Reject(FailedToLockInputs("Failed to Write lock substate component_459d...4443c:1 due to conflict with existing Write lock")) | ||
When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "increase" concurrently 2 times | ||
|
||
# Check that the counter has been increased | ||
# TODO: uncomment when concurrency is fully working | ||
# When I invoke on VAL_1 on component TX1/components/Counter the method call "value" the result is "2" | ||
# Note: this is currently not working together with the previous test case when times > 1, only the first transaction is being executed properly | ||
When I invoke on wallet daemon WALLET_D on account ACC on component COUNTER/components/Counter the method call "value" the result is "2" |