Skip to content

SteemPy based scripts for SPS testing

Dariusz Kędzierski edited this page Apr 12, 2019 · 4 revisions

Abstract: In this document we describe testing scripts for SPS.

Prerequisites

In order for scripts to work on musy first download and install steempy library with support for SPS. One can download current version with git command:

git clone git@github.com:blocktradesdevs/steem-python.git

Then checkout sps_support branch with:

git checkout sps_support

Install the library:

sudo python3 setup.py install

Python testing scripts

All scripts can be run in two modes. In the first mode user have to run steemd node by hand in the second the testing script will run selected node by itself, run the test and shutdown the node. For the second node to work one can set some parameters:

--run-steemd -- Path to steemd executable. Warning: using this option will erase contents of selected steemd working directory.

--working_dir -- Path to steemd working directory. Default is: /tmp/steemd-data/

--config_path -- Path to source config.ini file. Config file will be copied from locationg given in path to working dir. Default is set to ./steem_utils/resources/config.ini.in.

steempy_sps_tests.py

Script performs all available operations with SPS. This script will test: creating proposal, listing proposals in various ways, vote for proposal, list voters for given proposal, remove proposal and will test pagination algorithms.

Usage: ./steempy_sps_tests.py creator receiver creator-priv-key

Creator is a account name which will create test proposals, receiver is an account to receive funds from proposal. Creator-priv-key is a private key for creator account.

list_proposals_tests.py

Script will test various combinations of parameters for list_proposals operations. This test will: create proposals and will list_proposals in various ways using varying parameters.

Usage: ./list_proposals_tests.py creator receiver creator-priv-key

Creator is a account name which will create test proposals, receiver is an account to receive funds from proposal. Creator-priv-key is a private key for creator account.

id_collision_test.py

Manual test for ID collision in situation where several transactions are sent to different API nodes.

Usage: ./id_collision_test.py <proposal creator> <proposal receiver> <creator private key> <api node 1> <api node 2> ... <api node N>

For each API node a create_proposal transaction is created and then sent to all API nodes at once. Then API nodes are called for IDs of created proposals. IDs are listed in groups, grouped by API node. Then test waits 5 blocks and checks again for proposal IDs.

proposal_payment_test_001.py

Script will test payments for proposals. This test will:

  1. create testing accounts,
  2. each account will create one proposal - in this scenario all proposals have the same start and end date,
  3. each account will vote for all proposals,
  4. using debug node api blocks will be produced,
  5. payment for proposals will be verified with expected value.

Usage (with running node): ./proposal_payment_test_001.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_001.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.

proposal_payment_test_002.py

In this scenario all proposals have different start and end date.

Usage (with running node): ./proposal_payment_test_002.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_002.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.

proposal_payment_test_003.py

In this scenario we have one proposal with huge daily pay and couple with low daily pay, all proposals have the same number of votes, greedy proposal is first. All proposals have the same start and end date.

Usage (with running node): ./proposal_payment_test_003.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_003.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.

proposal_payment_test_004.py

In this scenario we have one proposal with huge daily pay and couple with low daily pay, all proposals have the same number of votes, greedy proposal is last. All proposals have the same start and end date.

Usage (with running node): ./proposal_payment_test_004.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_004.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.

proposal_payment_test_005.py

In this scenario we have one proposal with huge daily pay and couple with low daily pay, all proposals have the same number of votes, greedy proposal is first. All proposals have different start and end date.

Usage (with running node): ./proposal_payment_test_005.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_005.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.

proposal_payment_test_006.py

In this scenario we have one proposal with huge daily pay and couple with low daily pay all proposals have the same number of votes, greedy proposal is last. In this scenario proposals have different starting and ending dates.

Usage (with running node): ./proposal_payment_test_006.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_006.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.

proposal_payment_test_007.py

Script will test payments for proposals. This test will:

  1. create few proposals - in this scenario proposals have the same starting and ending dates
  2. vote on them to show differences in asset distribution (depending on collected votes)
  3. wait for proposal payment phase
  4. Unvote one of the proposal during payment phase
  5. verify (using account history and by checking regular account balance) that given accounts have been correctly paid.

Usage (with running node): ./proposal_payment_test_007.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_007.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.

proposal_payment_test_008.py

In this scenario we have one proposal with huge daily pay and couple with low daily pay all proposals have the same number of votes, greedy proposal is last. In this scenario proposals have different starting and ending dates.

Usage (with running node): ./proposal_payment_test_008.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_008.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.

proposal_payment_test_008.py

In this scenario we test circular payment, one proposal will pay to the treasury, other for to its creators.

Usage (with running node): ./proposal_payment_test_008.py creator treasury creator-priv-key

Usage (without running node): ./proposal_payment_test_008.py creator treasury creator-priv-key --run-steemd path-to-steemd-exec

Creator is a account name which will create test accounts, treasury is an account to pay for proposals. Creator-priv-key is a private key for creator account. Note: in order to test to work one have to provide private and public keys to testing accounts. Edit test file and provide required info in accounts table.