diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index e7010de2..b157b6e8 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -47,13 +47,4 @@ jobs: shell: bash run: | export PYTHONPATH=. - pytest -m "not skip_on_windows" . - - name: Run CLI tests - shell: bash - run: | - export PROXY=https://testnet-gateway.multiversx.com - export CHAIN_ID=T - cd ./multiversx_sdk_cli/tests - source ./test_cli_tx.sh && testAll || return 1 - source ./test_cli_dns.sh && testOffline || return 1 - source ./test_cli_validators.sh && testAll || return 1 + pytest -m "not skip_on_windows and not require_localnet" . diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9dda9a37..044f4b88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,8 +44,3 @@ jobs: run: | export PYTHONPATH=. pytest . - - name: Run CLI tests - run: | - cd ./multiversx_sdk_cli/tests - source ./test_cli_contracts.sh && testAll || return 1 - source ./test_cli_dns.sh && testOffline || return 1 diff --git a/.github/workflows/test-localnet-tests.yml b/.github/workflows/test-localnet-tests.yml new file mode 100644 index 00000000..8c62ad80 --- /dev/null +++ b/.github/workflows/test-localnet-tests.yml @@ -0,0 +1,55 @@ +name: Test localnet-dependent tests + +on: + pull_request: + branches: [main, feat/*] + workflow_dispatch: + +env: + BRANCH_NAME: ${{ github.head_ref || github.ref_name }} + +jobs: + localnet: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest] + python-version: [3.11] + + steps: + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python3 -m pip install --upgrade pip + pip3 install -r requirements.txt + pip3 install -r ./requirements-dev.txt --upgrade + + - name: Set up MultiversX localnet + run: | + mkdir -p ~/multiversx-sdk + export PYTHONPATH=. + python3 -m multiversx_sdk_cli.cli localnet prerequisites --configfile=./multiversx_sdk_cli/tests/testdata/localnet_with_resolution_remote.toml + python3 -m multiversx_sdk_cli.cli localnet build --configfile=./multiversx_sdk_cli/tests/testdata/localnet_with_resolution_remote.toml + + # "Go" and artifacts from "GOPATH/pkg/mod" are not needed anymore. + sudo rm -rf ~/multiversx-sdk/golang + + python3 -m multiversx_sdk_cli.cli localnet clean --configfile=./multiversx_sdk_cli/tests/testdata/localnet_with_resolution_remote.toml + python3 -m multiversx_sdk_cli.cli localnet config --configfile=./multiversx_sdk_cli/tests/testdata/localnet_with_resolution_remote.toml + nohup python3 -m multiversx_sdk_cli.cli localnet start --configfile=./multiversx_sdk_cli/tests/testdata/localnet_with_resolution_remote.toml > localnet.log 2>&1 & echo $! > localnet.pid + sleep 120 + + - name: Test localnet dependent tests + run: | + pytest -m require_localnet . + python3 -m multiversx_sdk_cli.cli localnet clean --configfile=./multiversx_sdk_cli/tests/testdata/localnet_with_resolution_remote.toml diff --git a/multiversx_sdk_cli/tests/conftest.py b/multiversx_sdk_cli/tests/conftest.py new file mode 100644 index 00000000..abff81f5 --- /dev/null +++ b/multiversx_sdk_cli/tests/conftest.py @@ -0,0 +1,10 @@ +import pytest + + +# function executed right after test items collected but before test run +def pytest_collection_modifyitems(config, items): + if not config.getoption('-m'): + skip_me = pytest.mark.skip(reason="require_localnet will only run if explicitly set to with -m") + for item in items: + if "require_localnet" in item.keywords: + item.add_marker(skip_me) diff --git a/multiversx_sdk_cli/tests/test_cli_all.sh b/multiversx_sdk_cli/tests/test_cli_all.sh old mode 100644 new mode 100755 index 28cb34f2..cd49eb4a --- a/multiversx_sdk_cli/tests/test_cli_all.sh +++ b/multiversx_sdk_cli/tests/test_cli_all.sh @@ -3,15 +3,14 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" USE_PROXY=$1 +source ./shared.sh +source ./test_cli_validators.sh && testAll + testAll() { pushd $SCRIPT_DIR source ./shared.sh - source ./test_cli_contracts.sh && testAll - source ./test_cli_dns.sh && testAll if [ -n "$USE_PROXY" ]; then - source ./test_cli_validators.sh && testAll - source ./test_cli_tx.sh && testAll source ./test_cli_config.sh && testAll fi popd diff --git a/multiversx_sdk_cli/tests/test_cli_dns.sh b/multiversx_sdk_cli/tests/test_cli_dns.sh deleted file mode 100644 index fa3c9340..00000000 --- a/multiversx_sdk_cli/tests/test_cli_dns.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env bash - -source "./shared.sh" - -REGISTRATION_COST=100 - -testOnline() { - testRegistrationOnline || return 1 - # Wait for nonces to be incremented (at source shards) - sleep 15 - testTransactionsWithUsernamesOnline || return 1 -} - -testRegistrationOnline() { - ${CLI} --verbose dns register --name="testuser" --pem=${TestUser} --value=${REGISTRATION_COST} \ - --recall-nonce --gas-limit=100000000 --gas-price=1000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txRegisterUser.txt --send --proxy=${PROXY} || return 1 - - ${CLI} --verbose dns register --name="testuser2" --pem=${TestUser2} --value=${REGISTRATION_COST} \ - --recall-nonce --gas-limit=100000000 --gas-price=1000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txRegisterUser2.txt --send --proxy=${PROXY} || return 1 -} - -testTransactionsWithUsernamesOnline() { - ${CLI} --verbose tx new --pem=${TestUser} --receiver=${TestUser2} \ - --value="1${DENOMINATION}" --recall-nonce --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txA.txt --send --proxy=${PROXY} || return 1 - - sleep 10 - - ${CLI} --verbose tx new --pem=${TestUser} --receiver=${TestUser2} --receiver-username="testuser2" \ - --value="1${DENOMINATION}" --recall-nonce --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txB.txt --send --proxy=${PROXY} || return 1 - - sleep 10 - - ${CLI} --verbose tx new --pem=${TestUser} --receiver=${TestUser2} --receiver-username="testuser2foo" \ - --value="1${DENOMINATION}" --recall-nonce --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txC.txt --send --proxy=${PROXY} || return 1 - - sleep 10 - - ${CLI} --verbose tx new --pem=${TestUser} --sender-username="testuser" --receiver=${TestUser2} --receiver-username="testuser2" \ - --value="1${DENOMINATION}" --recall-nonce --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txD.txt --send --proxy=${PROXY} || return 1 - - sleep 10 - - ${CLI} --verbose tx new --pem=${TestUser} --sender-username="testuser" --receiver=${TestUser2} \ - --value="1${DENOMINATION}" --recall-nonce --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txF.txt --send --proxy=${PROXY} || return 1 - - sleep 10 - - ${CLI} --verbose tx new --pem=${TestUser} --sender-username="testuserfoo" --receiver=${TestUser2} \ - --value="1${DENOMINATION}" --recall-nonce --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txG.txt --send --proxy=${PROXY} || return 1 -} - - -testOffline() { - testRegistrationOffline || return 1 - testTransactionsWithUsernamesOffline || return 1 -} - -testRegistrationOffline() { - ${CLI} --verbose dns register --name="testuser" --pem=${TestUser} --value=${REGISTRATION_COST} \ - --nonce=7 --gas-limit=100000000 --gas-price=1000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txRegisterUser.txt || return 1 - assertFileExists ${SANDBOX}/txRegisterUser.txt || return 1 - - ${CLI} --verbose dns register --name="testuser2" --pem=${TestUser2} --value=${REGISTRATION_COST} \ - --nonce=8 --gas-limit=100000000 --gas-price=1000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txRegisterUser2.txt || return 1 - assertFileExists ${SANDBOX}/txRegisterUser2.txt || return 1 -} - -testTransactionsWithUsernamesOffline() { - ${CLI} --verbose tx new --pem=${TestUser} --receiver="erd1ssmsc9022udc8pdw7wk3hxw74jr900xg28vwpz3z60gep66fasasl2nkm4" \ - --value="1${DENOMINATION}" --nonce=42 --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txA.txt || return 1 - assertFileExists ${SANDBOX}/txA.txt || return 1 - - ${CLI} --verbose tx new --pem=${TestUser} --receiver="erd1ssmsc9022udc8pdw7wk3hxw74jr900xg28vwpz3z60gep66fasasl2nkm4" --receiver-username="testuser2" \ - --value="1${DENOMINATION}" --nonce=43 --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txB.txt || return 1 - assertFileExists ${SANDBOX}/txB.txt || return 1 - - ${CLI} --verbose tx new --pem=${TestUser} --receiver="erd1ssmsc9022udc8pdw7wk3hxw74jr900xg28vwpz3z60gep66fasasl2nkm4" --receiver-username="testuser2foo" \ - --value="1${DENOMINATION}" --nonce=44 --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txC.txt || return 1 - assertFileExists ${SANDBOX}/txC.txt || return 1 - - ${CLI} --verbose tx new --pem=${TestUser} --sender-username="testuser" --receiver="erd1ssmsc9022udc8pdw7wk3hxw74jr900xg28vwpz3z60gep66fasasl2nkm4" --receiver-username="testuser2" \ - --value="1${DENOMINATION}" --nonce=45 --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txD.txt || return 1 - assertFileExists ${SANDBOX}/txD.txt || return 1 - - ${CLI} --verbose tx new --pem=${TestUser} --sender-username="testuser" --receiver="erd1ssmsc9022udc8pdw7wk3hxw74jr900xg28vwpz3z60gep66fasasl2nkm4" \ - --value="1${DENOMINATION}" --nonce=46 --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txF.txt || return 1 - assertFileExists ${SANDBOX}/txF.txt || return 1 - - ${CLI} --verbose tx new --pem=${TestUser} --sender-username="testuserfoo" --receiver="erd1ssmsc9022udc8pdw7wk3hxw74jr900xg28vwpz3z60gep66fasasl2nkm4" \ - --value="1${DENOMINATION}" --nonce=47 --gas-limit=50000 --gas-price=2000000000 --chain=${CHAIN_ID} \ - --outfile=${SANDBOX}/txG.txt || return 1 - assertFileExists ${SANDBOX}/txG.txt || return 1 -} - -testAll() { - testOnline || return 1 - testOffline || return 1 -} diff --git a/multiversx_sdk_cli/tests/test_cli_tx.sh b/multiversx_sdk_cli/tests/test_cli_tx.sh deleted file mode 100644 index 618073bb..00000000 --- a/multiversx_sdk_cli/tests/test_cli_tx.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash - -source "./shared.sh" - -BOB="erd1cux02zersde0l7hhklzhywcxk4u9n4py5tdxyx7vrvhnza2r4gmq4vw35r" - -testAll() { - cleanSandbox || return 1 - - echo "tx new, don't --send" - ${CLI} --verbose tx new --pem="${USERS}/alice.pem" --receiver=${BOB} --proxy=${PROXY} --value="1${DENOMINATION}" --recall-nonce --data="foo" --gas-limit=70000 --chain=${CHAIN_ID} --outfile=${SANDBOX}/txA.txt || return 1 - echo "tx send" - ${CLI} --verbose tx send --infile=${SANDBOX}/txA.txt --proxy=${PROXY} || return 1 - echo "tx new --send" - ${CLI} --verbose tx new --pem="${USERS}/bob.pem" --receiver=${BOB} --value="1${DENOMINATION}" --recall-nonce --data="foo" --gas-limit=60000 --chain=${CHAIN_ID} --send --outfile=${SANDBOX}/txB.txt --proxy=${PROXY} || return 1 - echo "tx new with --data-file" - echo '"{hello world!}"' > ${SANDBOX}/dummy.txt - ${CLI} --verbose tx new --pem="${USERS}/carol.pem" --receiver=${BOB} --value="1${DENOMINATION}" --recall-nonce --data-file=${SANDBOX}/dummy.txt --gas-limit=70000 --chain=${CHAIN_ID} --proxy=${PROXY} || return 1 - - echo "tx new --relay" - ${CLI} --verbose tx new --pem="${USERS}/dan.pem" --receiver=${BOB} --proxy=${PROXY} --value="1${DENOMINATION}" --nonce=1 --data="foo" --gas-limit=70000 --chain=${CHAIN_ID} --outfile=${SANDBOX}/txInner.txt --relay || return 1 - ${CLI} --verbose tx new --pem="${USERS}/eve.pem" --receiver=${BOB} --proxy=${PROXY} --value="1${DENOMINATION}" --recall-nonce --data-file=${SANDBOX}/txInner.txt --gas-limit=200000 --chain=${CHAIN_ID} --outfile=${SANDBOX}/txWrapper.txt || return 1 - - echo "tx new --simulate" - ${CLI} --verbose tx new --simulate --pem="${USERS}/frank.pem" --receiver=${BOB} --value="1${DENOMINATION}" --recall-nonce --data="foo" --gas-limit=70000 --chain=${CHAIN_ID} --proxy=${PROXY} || return 1 - - echo "tx new --send --wait-result" - ${CLI} --verbose tx new --send --wait-result --pem="${USERS}/grace.pem" --receiver=${BOB} --value="1${DENOMINATION}" --recall-nonce --data="foo" --gas-limit=70000 --chain=${CHAIN_ID} --proxy=${PROXY} || return 1 -} diff --git a/multiversx_sdk_cli/tests/test_cli_validators.py b/multiversx_sdk_cli/tests/test_cli_validators.py new file mode 100644 index 00000000..8b7cc521 --- /dev/null +++ b/multiversx_sdk_cli/tests/test_cli_validators.py @@ -0,0 +1,198 @@ +import pytest + +from pathlib import Path + +from multiversx_sdk_cli.cli import main + +testdata_path = Path(__file__).parent / "testdata" +testdata_out = Path(__file__).parent / "testdata-out" + +proxy_url = "http://localhost:7950/network/config" +alice_pem = testdata_path / "alice.pem" +reward_address = "erd1k2s324ww2g0yj38qn2ch2jwctdy8mnfxep94q9arncc6xecg3xaq6mjse8" +bls_key = "e7beaa95b3877f47348df4dd1cb578a4f7cabf7a20bfeefe5cdd263878ff132b765e04fef6f40c93512b666c47ed7719b8902f6c922c04247989b7137e837cc81a62e54712471c97a2ddab75aa9c2f58f813ed4c0fa722bde0ab718bff382208" + + +@pytest.mark.require_localnet +def test_stake(): + validators_json = testdata_path / "validators_ci.json" + + # Stake with recall nonce + return_code = main([ + "validator", "stake", + "--pem", str(alice_pem), + "--value", "2500000000000000000000", + "--validators-file", str(validators_json), + "--reward-address", reward_address, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + # Stake with provided nonce + return_code = main([ + "validator", "stake", + "--pem", str(alice_pem), + "--value", "2500000000000000000000", + "--validators-file", str(validators_json), + "--reward-address", reward_address, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--nonce=0" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_stake_top_up(): + # Stake with topUp + return_code = main([ + "validator", "stake", "--top-up", + "--pem", str(alice_pem), + "--value", "2711000000000000000000", + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_unstake(): + # Unstake + return_code = main([ + "validator", "unstake", + "--pem", str(alice_pem), + "--nodes-public-key", bls_key, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_unbond(): + # Unbond + return_code = main([ + "validator", "unbond", + "--pem", str(alice_pem), + "--nodes-public-key", bls_key, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_unjail(): + # Unjail + return_code = main([ + "validator", "unjail", + "--pem", str(alice_pem), + "--value", "2500000000000000000000", + "--nodes-public-key", bls_key, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_change_reward_address(): + # Change reward address + return_code = main([ + "validator", "change-reward-address", + "--pem", str(alice_pem), + "--reward-address", reward_address, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_unstake_nodes(): + # Unstake Nodes + return_code = main([ + "validator", "unstake-nodes", + "--pem", str(alice_pem), + "--nodes-public-key", bls_key, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_unstake_tokens(): + # Unstake Tokens + return_code = main([ + "validator", "unstake-tokens", + "--pem", str(alice_pem), + "--unstake-value", "11000000000000000000", + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_unbond_nodes(): + # Unbond nodes + return_code = main([ + "validator", "unbond-nodes", + "--pem", str(alice_pem), + "--nodes-public-keys", bls_key, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_unbond_tokens(): + # Unbond nodes + return_code = main([ + "validator", "unbond-tokens", + "--pem", str(alice_pem), + "--unbond-value", "20000000000000000000", + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_clean_registration_data(): + # Clean registration data + return_code = main([ + "validator", "clean-registered-data", + "--pem", str(alice_pem), + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 + + +@pytest.mark.require_localnet +def test_re_stake_unstaked_nodes(): + # Clean registration data + return_code = main([ + "validator", "restake-unstaked-nodes", + "--pem", str(alice_pem), + "--nodes-public-keys", bls_key, + "--chain", "localnet", + "--proxy", "http://127.0.0.1:7950", + "--estimate-gas", "--recall-nonce" + ]) + assert return_code == 0 diff --git a/multiversx_sdk_cli/tests/test_cli_validators.sh b/multiversx_sdk_cli/tests/test_cli_validators.sh deleted file mode 100755 index d489c9c0..00000000 --- a/multiversx_sdk_cli/tests/test_cli_validators.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -source "./shared.sh" - -testAll() { - BLS_KEY="e7beaa95b3877f47348df4dd1cb578a4f7cabf7a20bfeefe5cdd263878ff132b765e04fef6f40c93512b666c47ed7719b8902f6c922c04247989b7137e837cc81a62e54712471c97a2ddab75aa9c2f58f813ed4c0fa722bde0ab718bff382208" - REWARD_ADDRESS="erd1k2s324ww2g0yj38qn2ch2jwctdy8mnfxep94q9arncc6xecg3xaq6mjse8" - - echo "Stake with recall nonce" - ${CLI} --verbose validator stake --pem="${USERS}/alice.pem" --value="2500${DENOMINATION}" --validators-file=./testdata/validators.json --reward-address=${REWARD_ADDRESS} --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - echo "Stake with provided nonce" - ${CLI} --verbose validator stake --pem="${USERS}/bob.pem" --value="2500${DENOMINATION}" --validators-file=./testdata/validators.json --reward-address=${REWARD_ADDRESS} --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --nonce=300 || return 1 - - - echo "Stake with topUP" - ${CLI} --verbose validator stake --top-up --pem="${USERS}/carol.pem" --value="2711${DENOMINATION}" --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - - echo "Unstake" - ${CLI} --verbose validator unstake --pem="${USERS}/dan.pem" --nodes-public-keys="${BLS_KEY}" --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - echo "Unbond" - ${CLI} --verbose validator unbond --pem="${USERS}/eve.pem" --nodes-public-keys=${BLS_KEY} --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - echo "Unjail" - ${CLI} --verbose validator unjail --pem="${USERS}/frank.pem" --value="2500${DENOMINATION}" --nodes-public-keys=${BLS_KEY} --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - echo "Change reward address" - ${CLI} --verbose validator change-reward-address --pem="${USERS}/grace.pem" --reward-address=${REWARD_ADDRESS} --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - - echo "UnstakeNodes" - ${CLI} --verbose validator unstake-nodes --pem="${USERS}/heidi.pem" --nodes-public-keys=${BLS_KEY} --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - - echo "UnstakeTokens" - ${CLI} --verbose validator unstake-tokens --pem="${USERS}/ivan.pem" --unstake-value="11${DENOMINATION}" --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - - echo "UnbondNodes" - ${CLI} --verbose validator unbond-nodes --pem="${USERS}/judy.pem" --nodes-public-keys=${BLS_KEY} --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - - echo "UnbondTokens" - ${CLI} --verbose validator unbond-tokens --pem="${USERS}/mallory.pem" --unbond-value="20${DENOMINATION}" --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - - echo "CleanRegistrationData" - ${CLI} --verbose validator clean-registered-data --pem="${USERS}/mike.pem" --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 - - echo "ReStakeUnstakedNodes" - ${CLI} --verbose validator restake-unstaked-nodes --pem="${USERS}/alice.pem" --nodes-public-keys=${BLS_KEY} --chain=${CHAIN_ID} --proxy=${PROXY} --estimate-gas --recall-nonce || return 1 -} diff --git a/multiversx_sdk_cli/tests/testdata/validators_ci.json b/multiversx_sdk_cli/tests/testdata/validators_ci.json new file mode 100644 index 00000000..99a390c6 --- /dev/null +++ b/multiversx_sdk_cli/tests/testdata/validators_ci.json @@ -0,0 +1,13 @@ +{ + "validators": [ + { + "pemFile": "~/work/mx-sdk-py-cli/mx-sdk-py-cli/localnet/validator00/config/validatorKey.pem" + }, + { + "pemFile": "~/work/mx-sdk-py-cli/mx-sdk-py-cli/localnet/validator01/config/validatorKey.pem" + }, + { + "pemFile": "~/work/mx-sdk-py-cli/mx-sdk-py-cli/localnet/validator02/config/validatorKey.pem" + } + ] +} diff --git a/pytest.ini b/pytest.ini index 6669f27f..4cee0be1 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,7 @@ [pytest] markers = - skip_on_windows: marks tests as being skiped when running on windows (deselect with '-m "skip_on_windows"') + skip_on_windows: marks tests as being skipped when running on windows (deselect with '-m "skip_on_windows"') only: only run a specific test (run using: pytest -m "only") + require_localnet: marks tests that require a localnet (select with '-m "require_localnet"') log_cli = True