-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration tests #4
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functional it seems ok.
Just a general note: rebranding.
scripts/local-testnet.sh
Outdated
git checkout 4f82f49ede54e14b19f42028d910e41a728b3925 | ||
cd ../.. | ||
|
||
git clone https://github.com/ElrondNetwork/elrond-deploy-go "$TESTNET_DIR/elrond-deploy-go" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For what is elrond-deploy-go
needed in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, good catch.
It is not needed. Removed it
scripts/shardChecker.go
Outdated
|
||
shardBlocks := gjson.Get(string(body), "data.hyperblock.shardBlocks").Array() | ||
if len(shardBlocks) != 1 { | ||
return fmt.Errorf("checkShardHeader: should only have one shard, but got %d", len(shardBlocks)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should only have one shard or block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One shard only. It is described in the app usage and script usage as well:
script:
This script will start a firehose node in the provided shard(metachain/shard). The only acceptable parameters are shard(will use shard 0) and metachain for the current test configuration
checker:
app.Usage = "This tool only works if a local testnet and a firehose node are started. See firehose-node.sh and local-testnet.sh scripts"
Will also add a Readme here to make things clearer
scripts/shardChecker.go
Outdated
return checkShardAlteredAccounts(multiversxBlock.MultiversxBlock.AlteredAccounts, address) | ||
} | ||
|
||
func checkShardHeader(multiversxBlock *firehose.FirehoseBlock, shardBlocks []gjson.Result) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func checkShardHeader(multiversxBlock *firehose.FirehoseBlock, shardBlocks []gjson.Result) error { | |
func checkShardBlockHeader(multiversxBlock *firehose.FirehoseBlock, shardBlocks []gjson.Result) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, changed as suggested
scripts/shardChecker.go
Outdated
return fmt.Errorf("checkShardTxs: invalid computed tx hash, expected: %s, got %s", txHash, txProtocolHexHash) | ||
} | ||
|
||
initialPaidFeed := protocolTx.FeeInfo.GetInitialPaidFee() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initialPaidFeed := protocolTx.FeeInfo.GetInitialPaidFee() | |
initialPaidFee := protocolTx.FeeInfo.GetInitialPaidFee() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, good catch, changed it.
scripts/shardChecker.go
Outdated
|
||
initialPaidFeed := protocolTx.FeeInfo.GetInitialPaidFee() | ||
expectedInitialPaidFee := big.NewInt(txGasLimit * 1000000000) | ||
if initialPaidFeed.Cmp(expectedInitialPaidFee) != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if initialPaidFeed.Cmp(expectedInitialPaidFee) != 0 { | |
if initialPaidFee.Cmp(expectedInitialPaidFee) != 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored
scripts/wallet.go
Outdated
"github.com/ElrondNetwork/elrond-sdk-erdgo/interactors" | ||
) | ||
|
||
func getAddressAndSK(pemPath string) (core.AddressHandler, []byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func getAddressAndSK(pemPath string) (core.AddressHandler, []byte, error) { | |
func getAddressAndPK(pemPath string) (core.AddressHandler, []byte, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pk
is also an acronym for publicKey
.
Meanwhile, Sk
stands only for secretKey
, so I'd leave it as it is.
scripts/integration-test.sh
Outdated
cd testnet/elrond-go/cmd/keygenerator | ||
go build | ||
./keygenerator | ||
cd ../../../../../devel/standard/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion to use pushd
and popd
here instead of so many ../..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed as suggested
scripts/local-testnet.sh
Outdated
@@ -0,0 +1,122 @@ | |||
CURRENT_DIR=$(pwd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add #!/usr/bin/env bash
as first line for the main script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, added it
scripts/integration-test.sh
Outdated
@@ -0,0 +1,56 @@ | |||
CURRENT_DIR=$(pwd) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion to separate shell scripts and go code into separate folders, it's quite difficult to identify what to run and how, maybe add the info regarding scripts from PR description into a small README.md inside scripts folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Applied suggestion and split code in different folders.
Also added a README.md
Added integration tests scripts to start firehose ingestion nodes for metachain and shard with a local testnet automatically and check indexed data validity for custom scenario(
ESDTIssue
).Please note: This code(go) shall be reviewed as a testing framework code, not as a productive code. This is the reason why many values are hard-coded and certain variables are expected to be set to a specific value
Scripts:
main.go
contains the main scenario. It will:local-testnet.sh
- adaptation from this script to create/use a local testnetintegration-test.sh
- setup for a new firehose node +./start.sh
call to start indexer node(which will internally start a multiversx node- shard/meta; only 1 shard for current config)shard-meta-tests.sh
- starts with screen a new firehose+observer node in meta/shard id and calls goscript
(main.go after building) for the custom scenario.