From 483d0dfba7132f5a9eb35b0f8ef6d48780d1bf36 Mon Sep 17 00:00:00 2001 From: Aurora Gaffney Date: Tue, 2 Apr 2024 14:43:02 -0500 Subject: [PATCH] docs: update testing section of README --- README.md | 70 +++++++++++++--------------------------------- docker-compose.yml | 25 ----------------- 2 files changed, 20 insertions(+), 75 deletions(-) delete mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 4018ac6e..eb09d0c4 100644 --- a/README.md +++ b/README.md @@ -142,75 +142,45 @@ This is not an exhaustive list of existing and planned features, but it covers t ## Testing -Testing is currently a mostly manual process. There's an included test program that use the library -and a Docker Compose file to launch a local `cardano-node` instance. +gOuroboros includes automated tests that cover various aspects of its functionality, but not all. For more than the basics, +manual testing is required. -### Starting the local `cardano-node` instance +### Running the automated tests ``` -$ docker-compose up -d +make test ``` -If you want to use `mainnet`, set the `CARDANO_NETWORK` environment variable. +### Manual testing -``` -$ export CARDANO_NETWORK=mainnet -$ docker-compose up -d -``` - -You can communicate with the `cardano-node` instance on port `8081` (for "public" node-to-node protocol), port `8082` (for "private" node-to-client protocol), or -the `./tmp/cardano-node/ipc/node.socket` UNIX socket file (also for "private" node-to-client protocol). +Various small test programs can be found in `cmd/` in this repo or in the [gOuroboros Starter Kit](https://github.com/blinklabs-io/gouroboros-starter-kit) repo. +Some of them can be run against public nodes via NtN protocols, but some may require access to the UNIX socket of a local node for NtC protocols. -NOTE: if using the UNIX socket file, you may need to adjust the permissions/ownership to allow your user to access it. -The `cardano-node` Docker image runs as `root` by default and the UNIX socket ends up with `root:root` ownership -and `0755` permissions, which doesn't allow a non-root use to write to it by default. +#### Run chain-sync from the start of a particular era -### Running `cardano-cli` against local `cardano-node` instance - -``` -$ docker exec -ti gouroboros-cardano-node-1 sh -c 'CARDANO_NODE_SOCKET_PATH=/ipc/node.socket cardano-cli query tip --testnet-magic 1097911063' -``` - -### Building and running the test program - -Compile the test program. - -``` -$ make -``` +This is useful for testing changes to the handling of ledger types for a particular era. It will decode each block and either print +a summary line for the block or an error. -Run the test program pointing to the UNIX socket (via `socat`) from the `cardano-node` instance started above. +Start by building the test programs: ``` -$ ./gouroboros -address localhost:8082 -network testnet ... +make ``` -Run it against the public port in node-to-node mode. +Run the chain-sync test program against a public mainnet node, starting at the beginning of the Shelley era: ``` -$ ./gouroboros -address localhost:8081 -ntn -network testnet ... +./gouroboros -address backbone.cardano-mainnet.iohk.io:3001 -network mainnet -ntn chain-sync -bulk -start-era shelley ``` -Test chain-sync (works in node-to-node and node-to-client modes). +This will produce a LOT of output and take quite a few hours to reach chain tip. You're mostly looking for it to get through +all blocks of the chosen start era before hitting the next era or chain tip -``` -$ ./gouroboros ... chain-sync -start-era byron -``` - -Test local-tx-submission (only works in node-to-client mode). - -``` -$ ./gouroboros ... local-tx-submission ... -``` - -Test following the chain tip in the `preview` network. - -``` -$ ./gouroboros -network preview -address preview-node.world.dev.cardano.org:30002 -ntn chain-sync -tip -``` +#### Dump details of a particular block -### Stopping the local `cardano-node` instance +You can use the `block-fetch` program from `gouroboros-starter-kit` to fetch a particular block and dump its details. You must provide at least +the block slot and hash. This is useful for debugging decoding problems, since it allows fetching a specific block and decoding it over and over. ``` -$ docker-compose down --volumes +BLOCK_FETCH_SLOT=120521627 BLOCK_FETCH_HASH=afd4c97e32003d9803a305011cbd8796e6b36bf61576567206887e35795b6e09 ./block-fetch ``` diff --git a/docker-compose.yml b/docker-compose.yml deleted file mode 100644 index 502ff3fe..00000000 --- a/docker-compose.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: '3.9' - -volumes: - cardano-node-data: - -services: - cardano-node: - image: ghcr.io/blinklabs-io/cardano-node:8.1.2 - environment: - NETWORK: ${CARDANO_NETWORK:-preview} - ports: - - 8081:3001 - volumes: - - ./tmp/cardano-node/ipc:/ipc - - cardano-node-data:/data - - socat: - image: alpine/socat - command: - - TCP-LISTEN:8082,reuseaddr,fork - - UNIX-CONNECT:/ipc/node.socket - ports: - - 8082:8082 - volumes: - - ./tmp/cardano-node/ipc:/ipc