Skip to content

Commit

Permalink
Add new cardano-wallet-integration:e2e tests running on preprod (#4949
Browse files Browse the repository at this point in the history
)

- [x] Add a new `cardano-wallet-integration:e2e` test suite that:
- has, and intends to have, a minimal number of tests. It does not want
to duplicate everything from `cardano-wallet-integration`.
- mostly uses the same `Test.Integration.Framework.DSL` the integration
tests are written in
- is replacing `lib/wallet-e2e` and is intended to soon replace the ruby
e2e tests
- [x] Run this `cardano-wallet-integration:e2e` in CI on windows
- [new run which hopefully passes like the prev
one](https://buildkite.com/cardano-foundation/cardano-wallet/builds/9261#0194d089-3ef3-4f12-85ac-ad68f5a5f0b7)
and should now make the stages of the setup appear as sections in the
buildkite logs
- [x] No longer run ruby e2e tests on win

### Global preprod setup

We use only two wallets that are funded with ada. The transaction test
will send funds from the richer to the poorer wallet. This should reduce
the need for manual involvement as the funds last longer, and in a pinch
we could even get by funding just one of the test wallets.

### How to run

```bash
export HAL_E2E_PREPROD_MNEMONICS='<mnemonics be found in our vault>'
cabal test cardano-wallet-integration:e2e
```

With node and wallet stdout logs manually cleaned:

```bash
transactions
  simple transaction (TRANS_CREATE_01x) [✔]
stake pools
  list
    some have non-zero rewards, stake, producedBlocks, saturation [✔]
    some have metadata [‐]
      # PENDING: metadata fetching not configured; could be enabled
```

### Issue Number

#4931
  • Loading branch information
Anviking authored Feb 6, 2025
2 parents 3acbb2a + febb0bf commit 3de379e
Show file tree
Hide file tree
Showing 68 changed files with 791 additions and 2,611 deletions.
15 changes: 5 additions & 10 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ steps:
concurrency: 8
concurrency_group: 'linux-integration-tests'

- label: Run Haskell E2E Tests (linux)
command: 'nix develop --command bash -c "just e2e-local"'
soft_fail:
- exit_status: 130
timeout_in_minutes: 30
agents:
system: ${linux}

- block: Run Ruby E2E Tests (linux)
if: build.env("RELEASE_CANDIDATE") == null
depends_on: []
Expand Down Expand Up @@ -587,15 +579,18 @@ steps:
key: trigger-windows-e2e-tests

- label: ⚙️ Windows E2E Tests
timeout_in_minutes: 120
depends_on:
- trigger-windows-e2e-tests
commands:
- diff -r configs/cardano/preprod lib/integration/configs/cardano/preprod # ensure the configs don't diverge despite being duplicated
- ./scripts/buildkite/main/windows-e2e.bat
agents:
system: ${windows}
env:
TESTS_E2E_FIXTURES: "$FIXTURE_DECRYPTION_KEY"
NODE_DB_DIR: "test\\e2e\\state\\node_db\\preprod"
NODE_DB_DIR: "test\\e2e\\state\\node\\db"
NODE_DIR: "test\\e2e\\state\\node"
WALLET_DB_DIR: "test\\e2e\\state\\wallet"
AGGREGATOR_ENDPOINT: "${PREPROD_AGGREGATOR_ENDPOINT}"
GENESIS_VERIFICATION_KEY: "${PREPROD_GENESIS_VERIFICATION_KEY}"
concurrency: 1
Expand Down
1 change: 0 additions & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ packages:
lib/wai-middleware-logging/
lib/wallet-benchmarks/
lib/wallet/
lib/wallet-e2e/

--------------------------------------------------------------------------------
-- BEGIN OpenAPI
Expand Down
5 changes: 2 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@
inherit (project.hsPkgs.cardano-wallet.components.exes) mock-token-metadata-server;
inherit (project.hsPkgs.cardano-wallet-benchmarks.components.exes) benchmark-history;
inherit (project.hsPkgs.local-cluster.components.exes) local-cluster;
inherit (project.hsPkgs.cardano-wallet-integration.components.exes) integration-exe;
integration-exe = project.hsPkgs.cardano-wallet-integration.components.exes.integration-exe;
e2e = project.hsPkgs.cardano-wallet-integration.components.tests.e2e;
inherit (project.hsPkgs.local-cluster.components.exes) test-local-cluster-exe;

# Adrestia tool belt
Expand All @@ -227,8 +228,6 @@
deployments = pkgs.cardano-node-deployments;
};

cardano-wallet-e2e = project.hsPkgs.cardano-wallet-e2e.components.exes.wallet-e2e;

# Provide db-converter, so daedalus can ship it without needing to
# pin an ouroborus-network rev.
inherit (project.hsPkgs.ouroboros-consensus-byron.components.exes) db-converter;
Expand Down
28 changes: 7 additions & 21 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,17 @@ unit-tests-local-cluster-match match:
unit-tests-cabal:
just unit-tests-cabal-match ""

# run wallet-e2e suite against the preprod network
e2e-preprod:
nix shell \
'.#cardano-node' '.#cardano-wallet' '.#cardano-wallet-e2e' \
-c wallet-e2e preprod \
-s lib/wallet-e2e/test-state/preprod \
-c lib/wallet-e2e/config/cardano-node/preprod \
-t lib/wallet-e2e/test-output/preprod
# run cardano-wallet-integration:e2e suite against the preprod network
e2e:
# ugly env workaround as the default values work with cabal but not nix
WALLET_DB_DIR=test/e2e/state/wallet \
NODE_DIR=test/e2e/state/node \
NODE_DB_DIR=test/e2e/state/node/db \
nix shell '.#cardano-node' '.#cardano-wallet' '.#e2e' -c e2e

add_missing_json_goldens:
CREATE_MISSING_GOLDEN=1 just unit-tests-cabal-match "JSON"

# run wallet-e2e suite against the local test cluster
e2e-local:
nix shell \
'.#local-cluster' '.#cardano-node' '.#cardano-wallet' '.#cardano-wallet-e2e' \
-c wallet-e2e local \
-s lib/wallet-e2e/test-state/local \
-c lib/local-cluster/test/data/cluster-configs \
-t lib/wallet-e2e/test-output/local

# run wallet-e2e suite against the manually started node/wallet
e2e-manual:
nix run '.#cardano-wallet-e2e' -- manual

# run any integration test matching the given pattern via cabal
integration-tests-cabal-match match:
just integration-tests-cabal-options '--match="{{match}}"'
Expand Down
4 changes: 2 additions & 2 deletions lib/benchmarks/exe/latency-bench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -671,8 +671,7 @@ withShelleyServer tracers action = withFaucet $ \faucetClientEnv -> do
putMVar
ctx
Context
{ _cleanup = pure ()
, _manager = (baseUrl, manager)
{ _manager = (baseUrl, manager)
, _walletPort = Port . fromIntegral $ portFromURL baseUrl
, _faucet = faucet
, _networkParameters = np
Expand All @@ -682,6 +681,7 @@ withShelleyServer tracers action = withFaucet $ \faucetClientEnv -> do
, _smashUrl = ""
, _mainEra = maxBound
, _mintSeaHorseAssets = error "mintSeaHorseAssets not available"
, _preprodWallets = []
}
race_
(takeMVar ctx >>= action massiveWalletMnemonic')
Expand Down
28 changes: 28 additions & 0 deletions lib/integration/cardano-wallet-integration.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ library scenarios
Test.Integration.Scenario.CLI.Shelley.HWWallets
Test.Integration.Scenario.CLI.Shelley.Transactions
Test.Integration.Scenario.CLI.Shelley.Wallets
Test.Integration.Scenario.Preprod

common integration-common
import: language, opts-exe
Expand All @@ -216,6 +217,33 @@ common integration-common
executable integration-exe
import: integration-common
main-is: integration-tests-exe.hs
hs-source-dirs: exe

test-suite e2e
import: integration-common
type: exitcode-stdio-1.0
data-files: configs
hs-source-dirs: configs
build-depends:
, aeson
, bytestring
, cardano-addresses
, cardano-wallet-api
, cardano-wallet-exe
, cardano-wallet-integration:framework
, cardano-wallet-launcher
, cardano-wallet-primitive
, cardano-wallet-test-utils
, contra-tracer
, directory
, file-embed
, filepath
, hspec
, network-uri
, temporary
, text
, with-utf8
main-is: e2e.hs

test-suite integration
import: integration-common
Expand Down
9 changes: 9 additions & 0 deletions lib/integration/configs/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Pin line endings for genesis files.
#
# Genesis files are
# * human-readable text data
# * but they also have a hash.
#
# `cardano-node` is sensitive to the line endings in the genesis file.
#
**/*.json text eol=lf
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@
"stdout"
]
],
"hasEKG": 12788,
"hasPrometheus": [
"127.0.0.1",
12798
],
"minSeverity": "Info",
"options": {
"mapBackends": {
Expand Down
11 changes: 11 additions & 0 deletions lib/integration/configs/cardano/preprod/download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

set -euo pipefail

rm ./*.json
curl https://book.play.dev.cardano.org/environments-pre/preprod/config.json > config.json
curl https://book.play.dev.cardano.org/environments-pre/preprod/conway-genesis.json > conway-genesis.json
curl https://book.play.dev.cardano.org/environments-pre/preprod/topology.json > topology.json
curl https://book.play.dev.cardano.org/environments-pre/preprod/byron-genesis.json > byron-genesis.json
curl https://book.play.dev.cardano.org/environments-pre/preprod/shelley-genesis.json > shelley-genesis.json
curl https://book.play.dev.cardano.org/environments-pre/preprod/alonzo-genesis.json > alonzo-genesis.json
23 changes: 23 additions & 0 deletions lib/integration/configs/cardano/preprod/topology.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"bootstrapPeers": [
{
"address": "preprod-node.play.dev.cardano.org",
"port": 3001
}
],
"localRoots": [
{
"accessPoints": [],
"advertise": false,
"trustable": false,
"valency": 1
}
],
"publicRoots": [
{
"accessPoints": [],
"advertise": false
}
],
"useLedgerAfterSlot": 64454371
}
7 changes: 7 additions & 0 deletions lib/integration/configs/cardano/refresh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

set -euo pipefail

for dir in preprod; do
(cd "$dir" && ./download.sh)
done
Loading

0 comments on commit 3de379e

Please sign in to comment.