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

enable python integration tests. #1024

Merged
merged 7 commits into from
Dec 5, 2024
Merged

enable python integration tests. #1024

merged 7 commits into from
Dec 5, 2024

Conversation

jgreat
Copy link
Contributor

@jgreat jgreat commented Nov 26, 2024

Motivation

Create a wrapper around the python integration tests to make funding running tests easier.

  • ./tools/test-python-integration.sh - wrapper to setup, fund, run and return leftover funds.
  • Improve some outputs for the mob full-service cli tool.
    • 'balance' command for easier to parse balance output
    • 'export' command now accepts a flag for file name and path to save export json.
    • 'list' accepts optional flag to output a single account
  • Reduce funds required for test runs.
    • Test runs now transfer 0.001 MOB
    • Funding request is 0.02. reduces the amount of lost mob if something goes wrong and clean up steps cannot complete.
  • Create and fund new wallets for each test runs. The old saved wallets took over 30s to sync. Tests would timeout and fail while waiting for sync to complete.
  • Fund wallet from "FUNDING" full-service running in private network of the dev cluster. These wallets have minimal funding. Contact Ops for refills.
  • update .devcontainer to use host network so we can share localhost with port-forwarding or other full-service instances for funding.

Local Testing

Integration tests can be run locally with the tools/test-python-integration.sh script. This script is configured with a funding full-service instance with a funding account id and a target full-service instance. The intention is to port-forward the funding instances of dev-wallet-testnet and dev-wallet-mainnet instances to localhost.

The test script will

  1. Check that both target and funding full-service instances are available and environment is sane.
  2. create a new account on the target
  3. fund that new account from funding
  4. export and delete account on target
  5. run python tests
  6. look for leftover funds and return all funds to funding account.
  7. remove exported account file

Warning: Since the python tests create random accounts, the test script will scan the target full-service and attempt to send the remaining funds from any accounts still configured on the test full-service to the funding account.

Usage

tools/test-python-integration.sh <network>
    <network> - main|prod|test
Environment Variables:
    FUNDING_FS_URL - optional: URL of the funding full-service
    FUNDING_ACCOUNT_ID - optional: account_id of the funding account
    TARGET_FS_URL - optional: URL of the full-service we want to test
  • FUNDING_FS_URL defaults to http://localhost:9091/wallet/v2 for Testnet and http://localhost:9092/wallet/v2
  • FUNDING_ACCOUNT_ID - see script. These accounts are configured in the dev cluster and funded with a small amount of MOB for testing.
  • TARGET_FS_URL defaults to http://localhost:9090/wallet/v2 - this is FS instance you want to test

Automated Testing

For automated tests we launch Testnet and Mainnet copies of the current container build in the development cluster. These instances clone their ledger volume and database from existing volumes that are kept up to date by a nightly cronjob. This saves 10+ minuets on each run over copying the ledger in from scratch or a blob storage backup.

@jgreat jgreat force-pushed the jgreat/integration branch from afd742a to 186de19 Compare December 3, 2024 17:02
Copy link
Collaborator

@holtzman holtzman left a comment

Choose a reason for hiding this comment

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

Looks good. I picked a few nits but feel free to ignore

@jgreat jgreat merged commit f3ea165 into main Dec 5, 2024
26 checks passed
@jgreat jgreat deleted the jgreat/integration branch December 5, 2024 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants