datahaven/test/package.json
Tim B 82145b882b
test: 🐳 Add docker support for datahaven nodes (#71)
> [!NOTE]  
> This is  `Part 3` of the ongoing _Docker Series._


## New Additions:
- Launching Datahaven network will spin up containers, as opposed to
native binaries
- `stop:docker` script to kill all dh containers
- `e2e` test suite for datahaven solochain network
- Contains reference test file that uses papi for storage queries,
submitting exts, runtime calls (good job on that facu and tobi)
- Added new utils:
  - `waitForLog()` to wait for log lines in docker container logs
- `createPapiConnectors()` helper for test cases to build and connect to
dh network
- `getPapiSigner()` helper to return a papi compatible signer using our
prefunded accounts (alith by default)
- `sendTxn()` helper to submit txn and wait for block inclusion, instead
of finalization, which std library provides

## Changes:

> [!CAUTION] 
> Launching native binaries for datahaven no longer supported.


- Datahaven binary location cli option changed to `-i,
--datahaven-image-tag`
- To locally run this you'll need a datahaven docker image handy, you'll
need to either:
- Point to remote dockerhub e.g. `moonsonglabs/datahaven:main` (must be
logged in and have permission)
  - Build this locally with `bun build:docker:operator`

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added end-to-end tests for the Datahaven solochain, including runtime
API queries, storage lookups, extrinsic submissions, and event
listening.
- Introduced CLI option to specify the Datahaven Docker image tag, with
a default value.
  - Added CLI option to disable the Relayer.
- Provided new scripts to stop Docker containers associated with
Datahaven.
- Added utility functions for Docker log monitoring and container
startup checks.
- Introduced utilities for interacting with the Datahaven Polkadot API.

- **Improvements**
- Switched Datahaven network launch from local binaries to Docker
containers.
- Enhanced cache accuracy in build workflows by including Rust source
files in cache keys.
- Improved build performance with TypeScript incremental build options.
  - Increased timeout for end-to-end tests for better reliability.
  - Updated CLI version to 0.2.0.
  - Modified Dockerfile build to enable the `fast-runtime` feature.
- Extended network launch summary to include relayer and container
details.

- **Bug Fixes**
- Fixed cleanup logic by tracking and preparing for forced removal of
Docker containers after tests.

- **Chores**
  - Updated workflow steps for Docker image handling and network checks.
- Adjusted scripts and workflow logic for improved Docker and test
management.
- Removed top-level disk usage summaries from cleanup workflow for
streamlined reporting.
- Enhanced shell command utility to support asynchronous wait during
execution.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Facundo Farall <37149322+ffarall@users.noreply.github.com>
2025-05-16 15:17:05 +01:00

72 lines
No EOL
3.2 KiB
JSON

{
"name": "@datahaven/e2e-test",
"module": "index.ts",
"type": "module",
"private": true,
"scripts": {
"cli": "bun run cli/index.ts",
"fmt": "biome check .",
"fmt:fix": "biome check --write .",
"build:docker:operator": "docker buildx build --platform=linux/amd64 -t moonsonglabs/datahaven:local -f ../operator/Dockerfile ../.",
"build:docker:relayer": "bun -e \"import build from './scripts/snowbridge-relayer.ts'; build()\"",
"generate:wagmi": "wagmi generate",
"generate:snowbridge-cfgs": "bun -e \"import {generateSnowbridgeConfigs} from './scripts/gen-snowbridge-cfgs.ts'; await generateSnowbridgeConfigs()\"",
"generate:types": "(cd ../operator && cargo build --release) && bun x papi add --wasm \"../operator/target/release/wbuild/datahaven-stagenet-runtime/datahaven_stagenet_runtime.wasm\" datahaven",
"start:e2e:verified": "bun cli --verified --blockscout --deploy-contracts --setup-validators --update-validator-set --fund-validators",
"start:e2e:verified:relayers": "bun cli --verified --blockscout --deploy-contracts --setup-validators --update-validator-set --fund-validators --slot-time 1 --relayer --datahaven",
"start:e2e:ci": "bun cli --datahaven --launch-kurtosis --deploy-contracts --fund-validators --setup-validators --update-validator-set --relayer --always-clean",
"start:e2e:minrelayer": "bun cli --relayer --deploy-contracts --no-setup-validators --no-update-validator-set --no-fund-validators --datahaven",
"stop:docker": "docker ps -a --filter 'ancestor=moonsonglabs/datahaven:local' -q | xargs -r docker rm -f",
"stop:e2e": "bun stop:docker ;pkill datahaven ; pkill snowbridge-relay ; kurtosis enclave stop datahaven-ethereum && kurtosis clean && kurtosis engine stop && docker container prune -f",
"start:e2e:minimal:relayer": "bun cli --relayer --deploy-contracts --no-setup-validators --no-update-validator-set --no-fund-validators --datahaven",
"stop:e2e:verified": "bun stop:e2e",
"stop:e2e:quick": "kurtosis enclave stop datahaven-ethereum",
"stop:kurtosis-engine": "kurtosis engine stop && docker container prune -f",
"test:e2e": "bun test suites/e2e --timeout 60000",
"typecheck": "tsc --noEmit",
"postinstall": "papi"
},
"devDependencies": {
"@types/bun": "latest"
},
"peerDependencies": {
"typescript": "^5.8.3"
},
"dependencies": {
"@biomejs/biome": "^1.9.4",
"@commander-js/extra-typings": "^13.1.0",
"@dotenvx/dotenvx": "^1.41.0",
"@inquirer/prompts": "^7.5.0",
"@noble/curves": "^1.9.0",
"@noble/hashes": "^1.8.0",
"@polkadot-api/descriptors": "file:.papi/descriptors",
"@types/dockerode": "^3.3.38",
"@types/node": "^22.14.1",
"@wagmi/cli": "^2.3.0",
"@wagmi/core": "^2.17.0",
"chalk": "^5.4.1",
"commander": "^13.1.0",
"dockerode": "^4.0.6",
"dotenv": "^16.5.0",
"octokit": "^4.1.3",
"ora": "^8.2.0",
"pino": "^9.6.0",
"pino-pretty": "^13.0.0",
"polkadot-api": "^1.10.2",
"tiny-invariant": "^1.3.3",
"viem": "^2.28.0",
"wagmi": "^2.15.0",
"yaml": "^2.7.1",
"zod": "^3.24.3"
},
"trustedDependencies": [
"@biomejs/biome",
"bufferutil",
"cpu-features",
"esbuild",
"keccak",
"protobufjs",
"ssh2",
"utf-8-validate"
]
}