Skip to content
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

Added cli validators test in pytest and CI for localnet dependent tests. #454

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
c32d328
Added cli validators test in pytest and CI for localnet dependent tests.
cristure Oct 24, 2024
84efeb2
Added fixture for proxy polling.
cristure Oct 24, 2024
1685f02
try different endpoint for polling.
cristure Oct 24, 2024
f4e9c73
adding debug command.
cristure Oct 24, 2024
315e3b0
more debugging.
cristure Oct 24, 2024
39be1b4
make localnet run in background.
cristure Oct 24, 2024
18d6c71
added Dockerfile and integrated CI with docker.
cristure Oct 24, 2024
3f825a2
add checkout.
cristure Oct 24, 2024
99a198d
install python dependencies in order to trigger the tests.
cristure Oct 24, 2024
3d2be36
rename to localhost. possible issue with the loopback interface.
cristure Oct 24, 2024
beef139
debug commands
cristure Oct 24, 2024
95f1a15
more debugging.
cristure Oct 24, 2024
23b9961
add a sleep for debugging.
cristure Oct 24, 2024
ef9cdb2
trying to debug docker publishing in GHA.
cristure Oct 24, 2024
5043947
cosmetic changes
cristure Oct 24, 2024
4953eaa
move sleep above.
cristure Oct 24, 2024
a5ccb03
more debugging.
cristure Oct 24, 2024
7e889f1
increase timeout to 10 mins.
cristure Oct 24, 2024
0af4d95
check logs of docker localnet inside worker.
cristure Oct 24, 2024
05a7e57
fix CI and dockerfile by installing build-essential in the docker con…
cristure Oct 24, 2024
ec17dda
adding verbose command.
cristure Oct 24, 2024
1a4fe12
Fix deploy localnet job.
cristure Oct 25, 2024
900530f
fix whitespaces in multi-line command.
cristure Oct 25, 2024
17a08cf
fixing docker image and localnet setup.
cristure Oct 25, 2024
8359cbb
adding separate validators json file for docker tests.
cristure Oct 25, 2024
b43c31a
fixing Dockerfile
cristure Oct 25, 2024
bbe93e7
fix paths for validators_docker.json
cristure Oct 25, 2024
ad7e421
fix paths in validators_docker.json
cristure Oct 25, 2024
bfe909f
fix validators_docker.json
cristure Oct 25, 2024
83b76aa
fix yaml file.
cristure Oct 25, 2024
8804754
fix yaml file, round 2.
cristure Oct 25, 2024
d3d0d5c
add debug commands.
cristure Oct 25, 2024
9f9b8c0
debug home directory inside runner.
cristure Oct 25, 2024
79392ad
fix paths.
cristure Oct 25, 2024
d3f707d
more debugging.
cristure Oct 25, 2024
adaf45a
fix more paths.
cristure Oct 25, 2024
28fa958
add debug sleep.
cristure Oct 25, 2024
0e46464
cosmetic changes.
cristure Oct 25, 2024
7045c32
fix yaml file.
cristure Oct 25, 2024
5f0f807
remove docker
cristure Nov 4, 2024
7a1c8cb
fix mxpy commands in CI.
cristure Nov 4, 2024
6d2888e
cosmetic changes.
cristure Nov 4, 2024
685ca9e
debug strings
cristure Nov 4, 2024
7bdab1a
more debug commands.
cristure Nov 4, 2024
343ba6b
fix CI tests and remove docker naming.
cristure Nov 4, 2024
bf164f6
remove polling.
cristure Nov 4, 2024
e8137fa
cosmetic changes.
cristure Nov 4, 2024
3fb2a0e
fix unused fixture.
cristure Nov 4, 2024
af2c955
remove polling fixture.
cristure Nov 4, 2024
c7d799f
more debugging.
cristure Nov 4, 2024
5a274c4
show log in CI.
cristure Nov 4, 2024
42c1260
more debugging in CI.
cristure Nov 4, 2024
1ba5d85
more debugging in CI.
cristure Nov 4, 2024
25760e9
check logs in CI.
cristure Nov 4, 2024
fe180f0
rewrite setting up commands.
cristure Nov 4, 2024
61bf291
debug.
cristure Nov 4, 2024
4ce863e
more commands.
cristure Nov 4, 2024
380c08b
make nohup run in background.
cristure Nov 4, 2024
58e29a0
debug localnet config.
cristure Nov 4, 2024
31b6563
more debugging paths.
cristure Nov 4, 2024
92e6386
fix paths for ci validator keys file.
cristure Nov 4, 2024
e8c89e1
clean remaining commented code.
cristure Nov 4, 2024
0080690
added conftest and strict markers.
cristure Nov 4, 2024
69404f0
modified skip on windows marker.
cristure Nov 5, 2024
c2adbf2
fix skip_on_windows marker
cristure Nov 5, 2024
1b1a414
fix windows build
cristure Nov 5, 2024
4067411
remove duplicated bash tests and added teardown for localnet tests.
cristure Nov 5, 2024
572725d
Revert "remove duplicated bash tests and added teardown for localnet …
cristure Nov 5, 2024
eb42289
bring back bash tests as they are used in other tests.
cristure Nov 5, 2024
10ffa3c
added teardown for localnet.
cristure Nov 5, 2024
d382db0
clean unused bash tests.
cristure Nov 5, 2024
7ab16ba
remove cli tests for windows.
cristure Nov 6, 2024
ca1d4fd
remove deleted shell scripts.
cristure Nov 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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" .
5 changes: 0 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
55 changes: 55 additions & 0 deletions .github/workflows/test-localnet-tests.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions multiversx_sdk_cli/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import pytest

Check failure on line 1 in multiversx_sdk_cli/tests/conftest.py

View workflow job for this annotation

GitHub Actions / runner / mypy

[mypy] reported by reviewdog 🐶 Cannot find implementation or library stub for module named "pytest" [import-not-found] Raw Output: /home/runner/work/mx-sdk-py-cli/mx-sdk-py-cli/multiversx_sdk_cli/tests/conftest.py:1:1: error: Cannot find implementation or library stub for module named "pytest" [import-not-found]


# 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)
7 changes: 3 additions & 4 deletions multiversx_sdk_cli/tests/test_cli_all.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
113 changes: 0 additions & 113 deletions multiversx_sdk_cli/tests/test_cli_dns.sh

This file was deleted.

29 changes: 0 additions & 29 deletions multiversx_sdk_cli/tests/test_cli_tx.sh

This file was deleted.

Loading
Loading