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

Update tests to be able to run using a leap dev-install package. #355

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
1a73eb8
Update tests to be able to run using a leap dev-install package.
oschwaldp-oci Mar 14, 2023
13fe485
Merge branch 'main' into update-tests-to-use-leap-dev-install
oschwaldp-oci Mar 14, 2023
6076d9e
Merge branch 'main' into update-tests-to-use-leap-dev-install
oschwaldp-oci Mar 21, 2023
2f3cdba
Merge branch 'main' into update-tests-to-use-leap-dev-install
oschwaldp-oci Jul 19, 2023
d3f9b04
Add leap integration test to contract CICD workflow.
oschwaldp-oci Jul 19, 2023
4995c16
Add install web3 to workflow.
oschwaldp-oci Jul 19, 2023
0e9d95c
Put leap integration test into own job in workflow.
oschwaldp-oci Jul 19, 2023
7f7d855
Revert back to CDT v3.1.0 for leap integration test
oschwaldp-oci Jul 20, 2023
8340a29
Try setting the PYTHONPATH
oschwaldp-oci Jul 20, 2023
33f27a4
Fix python path to installed leap-dev modules.
oschwaldp-oci Jul 20, 2023
ba3bf65
See where leap-dev is being installed.
oschwaldp-oci Jul 20, 2023
4c3ac5f
Endeavor to fix the python path to TestHarness.
oschwaldp-oci Jul 20, 2023
aafc9a2
Debugging lack of symlink during install.
oschwaldp-oci Jul 20, 2023
f1c2b10
Revert back to installing using apt-get.
oschwaldp-oci Jul 20, 2023
f107499
Walk web3 back to a potentially more stable version.
oschwaldp-oci Jul 20, 2023
80ecdf8
Fix pip install version selection.
oschwaldp-oci Jul 20, 2023
8bdd860
Working through dependency issues.
oschwaldp-oci Jul 21, 2023
36acfe3
Sudo to gain permissions to create the symlink.
oschwaldp-oci Jul 21, 2023
7e02722
Remove PYTHONPATH now that symlink is created.
oschwaldp-oci Jul 21, 2023
2f65d15
Set test environment variables.
oschwaldp-oci Jul 24, 2023
a16a4c2
Revert "Set test environment variables."
oschwaldp-oci Jul 24, 2023
836fe14
Leap integration test workflow updates.
oschwaldp-oci Jul 25, 2023
c18a1f4
Workflow updates.
oschwaldp-oci Jul 25, 2023
16aa944
Fix syntax.
oschwaldp-oci Jul 25, 2023
eb484fa
Elevate permissions.
oschwaldp-oci Jul 25, 2023
8acaca5
Make logs checking steps always run even on failure.
oschwaldp-oci Jul 25, 2023
d8f5ec8
Build eos-evm-node step.
oschwaldp-oci Jul 25, 2023
43dbf43
Upload test logs when test fails.
oschwaldp-oci Jul 25, 2023
7b6a1ee
check the genesis file.
oschwaldp-oci Jul 26, 2023
d2b49ab
Run with verbose output.
oschwaldp-oci Jul 26, 2023
12d4576
Make root directory for testing to collect all artifacts.
oschwaldp-oci Jul 26, 2023
166bf93
Increase eos-evm-node verbosity for debugging workflow in cicd.
oschwaldp-oci Jul 26, 2023
78e28c6
Debug where the test logs directory is.
oschwaldp-oci Jul 26, 2023
534fd66
Give eos-evm-node longer to spin up and sync.
oschwaldp-oci Jul 26, 2023
0cb41ad
Allow waiting and retrying row validation with eos-evm-node for slowe…
oschwaldp-oci Jul 26, 2023
ad13c15
Trying to debug log upload.
oschwaldp-oci Jul 26, 2023
7f679fe
Increase sleep time for syncing.
oschwaldp-oci Jul 26, 2023
02079ac
Troubleshooting eos evm node not spinning up in time and whether slee…
oschwaldp-oci Jul 27, 2023
f2c09a7
Now that uploading all logs, don't need these steps.
oschwaldp-oci Jul 27, 2023
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
61 changes: 61 additions & 0 deletions .github/workflows/contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,64 @@ jobs:
name: test-results.xml
path: test-results.xml
if-no-files-found: error

leap-integration:
runs-on: ubuntu-20.04
name: EOS EVM Leap Integration Tests
env:
CC: gcc-10
CXX: g++-10
DCMAKE_BUILD_TYPE: 'Release'

steps:
- name: Authenticate
id: auth
uses: AntelopeIO/github-app-token-action@v1
with:
app_id: ${{ secrets.TRUSTEVM_CI_APP_ID }}
private_key: ${{ secrets.TRUSTEVM_CI_APP_KEY }}

- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
token: ${{ steps.auth.outputs.token }}

- name: Download CDT
uses: AntelopeIO/asset-artifact-download-action@v2
with:
owner: AntelopeIO
repo: cdt
target: 'v3.1.0'
prereleases: false
file: 'cdt_.*amd64.deb'
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install CDT
run: sudo apt-get install -y ./cdt*.deb

- name: Build EOS EVM Contract
run: .github/workflows/build-contract.sh
env:
DWITH_TEST_ACTIONS: ${{ matrix.DWITH_TEST_ACTIONS }}

- name: Download Leap - dev binary
uses: AntelopeIO/asset-artifact-download-action@v2
with:
owner: AntelopeIO
repo: leap
target: 'v4'
prereleases: false
file: 'leap-dev.*(x86_64|amd64).deb'
container-package: experimental-binaries
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install Leap
run: sudo apt-get install -y ./leap*.deb

- name: Test Leap Integration
run: |
pip install web3
export PYTHONPATH=/usr/local/lib/python3/dist-packages
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did something change? afaik all this should be installed in /usr when built in CI
https://github.com/AntelopeIO/leap/blob/main/.github/workflows/build_base.yaml#L80

Copy link
Contributor Author

@oschwaldp-oci oschwaldp-oci Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I'm endeavoring to figure out. I just did build using the pinned_build.sh script and then installed the lead-dev pkg it created from the v4.0.4 tag. Using dpkg -L leap-dev it appeared that TestHarness was installed in /usr/local/lib/python3/dist-packages/TestHarness. But it still isn't finding the module there either. Or rather, it is a symlink to /usr/local/share/leap_testing/tests/TestHarness

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, pinned_build.sh does /usr/local by default (but not in CI where it's also /usr)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noted. Updated the location where it installed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to export PYTHONPATH in this case, where the test in leap doesn't need to?
https://github.com/AntelopeIO/leap/blob/main/.github/workflows/build.yaml#L98

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm trying to chase that down. My current theory is that the symlink isn't being created to put the TestHarness into the python3/dist-packages. This build is running cmake version 3.26.4. Not sure which version is being used over in the leap workflow since there is a switch in https://github.com/AntelopeIO/leap/blob/78c1b62a76b37ac3531e526b8434c1ce54a451c2/CMakeLists.txt#L252

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dpkg -L leap-dev | grep TestHarness in this workflow is not showing the symlink:

/usr/share/leap_testing/tests/TestHarness
/usr/share/leap_testing/tests/TestHarness/Cluster.py
/usr/share/leap_testing/tests/TestHarness/Node.py
/usr/share/leap_testing/tests/TestHarness/TestHelper.py
/usr/share/leap_testing/tests/TestHarness/WalletMgr.py
/usr/share/leap_testing/tests/TestHarness/__init__.py
/usr/share/leap_testing/tests/TestHarness/core_symbol.py
/usr/share/leap_testing/tests/TestHarness/depresolver.py
/usr/share/leap_testing/tests/TestHarness/interfaces.py
/usr/share/leap_testing/tests/TestHarness/launch_transaction_generators.py
/usr/share/leap_testing/tests/TestHarness/libc.py
/usr/share/leap_testing/tests/TestHarness/logging-template.json
/usr/share/leap_testing/tests/TestHarness/logging.py
/usr/share/leap_testing/tests/TestHarness/queries.py
/usr/share/leap_testing/tests/TestHarness/testUtils.py
/usr/share/leap_testing/tests/TestHarness/transactions.py

https://github.com/eosnetworkfoundation/eos-evm/actions/runs/5613879938/job/15210866007

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although local build (note: using pinned_build.sh to create leap-dev) with cmake version 3.22.1 does:

/usr/local/share/leap_testing/tests/TestHarness
/usr/local/share/leap_testing/tests/TestHarness/Cluster.py
/usr/local/share/leap_testing/tests/TestHarness/Node.py
/usr/local/share/leap_testing/tests/TestHarness/TestHelper.py
/usr/local/share/leap_testing/tests/TestHarness/WalletMgr.py
/usr/local/share/leap_testing/tests/TestHarness/__init__.py
/usr/local/share/leap_testing/tests/TestHarness/core_symbol.py
/usr/local/share/leap_testing/tests/TestHarness/depresolver.py
/usr/local/share/leap_testing/tests/TestHarness/interfaces.py
/usr/local/share/leap_testing/tests/TestHarness/launch_transaction_generators.py
/usr/local/share/leap_testing/tests/TestHarness/libc.py
/usr/local/share/leap_testing/tests/TestHarness/logging-template.json
/usr/local/share/leap_testing/tests/TestHarness/logging.py
/usr/local/share/leap_testing/tests/TestHarness/queries.py
/usr/local/share/leap_testing/tests/TestHarness/testUtils.py
/usr/local/share/leap_testing/tests/TestHarness/transactions.py
/usr/local/lib/python3/dist-packages/TestHarness

So from that perspective it doesn't look like a cmake version problem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where: /usr/local/lib/python3/dist-packages/TestHarness -> ../../../share/leap_testing/tests/TestHarness

Copy link
Contributor Author

@oschwaldp-oci oschwaldp-oci Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that this is due to the postinst script relying on CMAKE_INSTALL_FULL_LIBDIR in v4.0.4 which sets the path for the symlink incorrectly to: ln -s ../../../share/leap_testing/tests/TestHarness /usr/lib/x86_64-linux-gnu/python3/dist-packages/TestHarness.

This has been fixed in main: https://github.com/AntelopeIO/leap/blob/main/scripts/postinst

Thus, currently setting the PYTHONPATH is a workaround to allow discovery of the installed python modules from leap-dev

./tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ./contract/build --eos-evm-build-root ./build --use-tx-wrapper ./peripherals/tx_wrapper
18 changes: 11 additions & 7 deletions tests/leap/nodeos_eos_evm_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
from web3 import Web3
import rlp

sys.path.append(os.getcwd())
sys.path.append(os.path.join(os.getcwd(), "tests"))

from TestHarness import Cluster, TestHelper, Utils, WalletMgr
os.environ["CORE_SYMBOL_NAME"]='EOS'
print(f"CORE_SYMBOL_NAME: {os.environ.get('CORE_SYMBOL_NAME')}")

from TestHarness import Cluster, TestHelper, Utils, WalletMgr, CORE_SYMBOL
from TestHarness.TestHelper import AppArgs
from TestHarness.testUtils import ReturnType
from TestHarness.testUtils import unhandledEnumType
from core_symbol import CORE_SYMBOL

from antelope_name import convert_name_to_value

Expand All @@ -53,10 +54,13 @@
# --eos-evm-build-root should point to the root of EOS EVM build dir
# --eos-evm-contract-root should point to root of EOS EVM contract build dir
#
# Example:
# cd ~/ext/leap/build
# edit tests/core_symbol.py to be EOS
# ~/ext/eos-evm/tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ~/ext/eos-evm/contract/build --eos-evm-build-root ~/ext/eos-evm/build --use-tx-wrapper ~/ext/eos-evm/peripherals/tx_wrapper --leave-running
# Example (Running with leap src build):
# cd ~/leap/build
# ~/eos-evm/tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ~/eos-evm/contract/build --eos-evm-build-root ~/eos-evm/build --use-tx-wrapper ~/eos-evm/peripherals/tx_wrapper --leave-running
#
# Example (Running with leap dev-install):
# export PYTHONPATH=<leap-dev-install-root>/lib/python3/dist-packages
# ~/eos-evm/tests/leap/nodeos_eos_evm_test.py --eos-evm-contract-root ~/eos-evm/contract/build --eos-evm-build-root ~/eos-evm/build --use-tx-wrapper ~/eos-evm/peripherals/tx_wrapper --leave-running
#
# Launches wallet at port: 9899
# Example: bin/cleos --wallet-url http://127.0.0.1:9899 ...
Expand Down
Loading