Skip to content

Commit

Permalink
Clean clone test for better readability
Browse files Browse the repository at this point in the history
  • Loading branch information
cedelavergne-ledger committed Apr 11, 2024
1 parent c7925b1 commit 80db8f8
Show file tree
Hide file tree
Showing 35 changed files with 17 additions and 27 deletions.
18 changes: 6 additions & 12 deletions .github/workflows/build_and_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,20 @@ jobs:
download_app_binaries_artifact: "ragger_elfs"

build_clone_app:
name: Build Clone application using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
upload_app_binaries_artifact: "clone_elfs"

build_main_app:
name: Build Main app using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_build.yml@v1
with:
flags: "CHAIN=thundercore"
upload_app_binaries_artifact: "main_elfs"
upload_app_binaries_artifact: "clone_elfs"

ragger_clone_tests:
name: Run ragger tests using the reusable workflow for lib context
name: Run ragger Clone tests using the reusable workflow
needs:
- build_application
- build_clone_app
- build_main_app
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_ragger_tests.yml@v1
with:
download_app_binaries_artifact: "clone_elfs"
additional_app_binaries_artifact: "main_elfs"
additional_app_binaries_artifact_dir: ./tests/.test_dependencies/main/build/
download_app_binaries_artifact: "ragger_elfs"
additional_app_binaries_artifact: "clone_elfs"
additional_app_binaries_artifact_dir: ./tests/ragger/.test_dependencies/clone/build/
test_options: "--with_lib_mode"
Empty file.
10 changes: 3 additions & 7 deletions tests/ragger/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ def pytest_addoption(parser):
parser.addoption("--with_lib_mode", action="store_true", help="Run the test with Library Mode")


parent: Path = Path(__file__).parent.parent
testFiles = glob.glob("test_*.py", root_dir=f"{parent}/ragger")
parent: Path = Path(__file__).parent
testFiles = glob.glob("test_*.py", root_dir=f"{parent}")
collect_ignore = []
if "--with_lib_mode" in sys.argv:

Expand All @@ -28,11 +28,7 @@ def pytest_addoption(parser):

warnings.warn("Main app is started in library mode")

# Check dependencies directory exists
test_dir: Path = Path(parent, ".test_dependencies")
assert test_dir.exists()

configuration.OPTIONAL.MAIN_APP_DIR = "tests/.test_dependencies/"
configuration.OPTIONAL.MAIN_APP_DIR = "tests/ragger/.test_dependencies/"

collect_ignore += [f for f in testFiles if "test_clone" not in f]

Expand Down
Binary file removed tests/ragger/snapshots/nanos/test_clone_etc/00001.png
Binary file not shown.
Binary file removed tests/ragger/snapshots/nanos/test_clone_etc/00002.png
Binary file not shown.
Binary file removed tests/ragger/snapshots/nanos/test_clone_etc/00003.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion tests/ragger/snapshots/nanosp/test_clone_etc

This file was deleted.

1 change: 1 addition & 0 deletions tests/ragger/snapshots/nanosp/test_clone_thundercore
Binary file removed tests/ragger/snapshots/nanox/test_clone_etc/00001.png
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
14 changes: 7 additions & 7 deletions tests/ragger/test_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
NONCE = 68
GAS_PRICE = 13
GAS_LIMIT = 21000
VALUE = 31415926913374232
VALUE = 0.31415


# Legacy Zemu etc with clone: Transfer on Ethereum clone app
def test_clone_etc(firmware: Firmware,
backend: BackendInterface,
navigator: Navigator,
test_name: str):
def test_clone_thundercore(firmware: Firmware,
backend: BackendInterface,
navigator: Navigator,
test_name: str):
tx_params: dict = {
"nonce": NONCE,
"gasPrice": Web3.to_wei(GAS_PRICE, 'gwei'),
"gas": GAS_LIMIT,
"to": ADDR,
"value": VALUE,
"value": Web3.to_wei(VALUE, "ether"),
"chainId": 108
}
common(firmware, backend, navigator, tx_params, test_name)
common(firmware, backend, navigator, tx_params, test_name, BIP32_PATH)

0 comments on commit 80db8f8

Please sign in to comment.